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" ) type sqlStore struct { db db.DB } func (ss *sqlStore) MigrateDatasources(ctx context.Context, request *cloudmigration.MigrateDatasourcesRequest) (*cloudmigration.MigrateDatasourcesResponse, error) { return nil, cloudmigration.ErrInternalNotImplementedError } 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 } func (ss *sqlStore) GetAllCloudMigrations(ctx context.Context) ([]*cloudmigration.CloudMigration, error) { var migrations = make([]*cloudmigration.CloudMigration, 0) err := ss.db.WithDbSession(ctx, func(sess *db.Session) error { return sess.Find(&migrations) }) if err != nil { return nil, err } return migrations, nil }