[v11.0.x] Cloudmigration: create migration (#86373)
Cloudmigration: create migration (#85386)
* Cloudmigration: create migration
* fix drone build
* lint fix
* fix unit test
---------
Co-authored-by: Michael Mandrus <michael.mandrus@grafana.com>
(cherry picked from commit 383ebb2bc4)
Co-authored-by: Leonard Gram <leo@xlson.com>
This commit is contained in:
co-authored by
Leonard Gram
parent
98401be295
commit
f4539f7e9d
@@ -2,6 +2,9 @@ package cloudmigrationimpl
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/services/cloudmigration"
|
||||
@@ -15,7 +18,19 @@ func (ss *sqlStore) MigrateDatasources(ctx context.Context, request *cloudmigrat
|
||||
return nil, cloudmigration.ErrInternalNotImplementedError
|
||||
}
|
||||
|
||||
func (ss *sqlStore) CreateMigration(ctx context.Context, token cloudmigration.Base64EncodedTokenPayload) error {
|
||||
func (ss *sqlStore) CreateMigration(ctx context.Context, migration cloudmigration.CloudMigration) error {
|
||||
err := ss.db.WithDbSession(ctx, func(sess *sqlstore.DBSession) error {
|
||||
migration.Created = time.Now()
|
||||
migration.Updated = time.Now()
|
||||
_, err := sess.Insert(migration)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user