Cloudmigration: create migration (#85386)
* Cloudmigration: create migration * fix drone build * lint fix * fix unit test --------- Co-authored-by: Michael Mandrus <michael.mandrus@grafana.com>
This commit is contained in:
co-authored by
Michael Mandrus
parent
db6b51cb88
commit
383ebb2bc4
@@ -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