Cloud Migration: Remove ID migration in favor of UID (#86550)
* - Added migration to add a new collumn UID to both migration and migration_run tables. - Added migration to set UID for records already existent in the database before adding a new column. - Added UID field to CloudMigration and CloudMigrationRun dtos (model.go) * Fix db migration * Updating store and model * Updating API to use UID * fix typo * update openapi specs and generated endpoints * fix spec * update openapi specs and generated endpoints * Fixing db mapping * Fix frontend * fix migration * remove migration uid from run fetch endpoint * Revert "merge" This reverts commitd654e4c530, reversing changes made to5fe0b483eb. * manual merge * rename some funcs for consistency * make interfaces consistent * validate uids * update generated frontend api * fix enterprise spec * manually resolve api * try again * try yet again * once more --------- Co-authored-by: Josh Hunt <joshhunt@users.noreply.github.com> Co-authored-by: Michael Mandrus <michael.mandrus@grafana.com> Co-authored-by: joshhunt <josh@trtr.co>
This commit is contained in:
co-authored by
Josh Hunt
Michael Mandrus
joshhunt
parent
fcb40e601d
commit
0719f73f35
@@ -16,9 +16,10 @@ var (
|
||||
ErrMigrationNotDeleted = errutil.Internal("cloudmigrations.migrationNotDeleted", errutil.WithPublicMessage("Migration not deleted"))
|
||||
)
|
||||
|
||||
// cloud migration api dtos
|
||||
// CloudMigration api dtos
|
||||
type CloudMigration struct {
|
||||
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
|
||||
UID string `json:"uid" xorm:"uid"`
|
||||
AuthToken string `json:"-"`
|
||||
Stack string `json:"stack"`
|
||||
StackID int `json:"stackID" xorm:"stack_id"`
|
||||
@@ -48,7 +49,8 @@ type MigratedResource struct {
|
||||
|
||||
type CloudMigrationRun struct {
|
||||
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
|
||||
CloudMigrationUID string `json:"uid" xorm:"cloud_migration_uid"`
|
||||
UID string `json:"uid" xorm:"uid"`
|
||||
CloudMigrationUID string `json:"migrationUid" xorm:"cloud_migration_uid"`
|
||||
Result []byte `json:"result"` //store raw cms response body
|
||||
Created time.Time `json:"created"`
|
||||
Updated time.Time `json:"updated"`
|
||||
@@ -61,7 +63,7 @@ func (r CloudMigrationRun) ToResponse() (*MigrateDataResponseDTO, error) {
|
||||
if err != nil {
|
||||
return nil, errors.New("could not parse result of run")
|
||||
}
|
||||
result.RunID = r.ID
|
||||
result.RunUID = r.UID
|
||||
return &result, nil
|
||||
}
|
||||
|
||||
@@ -81,7 +83,7 @@ type CloudMigrationRequest struct {
|
||||
}
|
||||
|
||||
type CloudMigrationResponse struct {
|
||||
ID int64 `json:"id"`
|
||||
UID string `json:"uid"`
|
||||
Stack string `json:"stack"`
|
||||
Created time.Time `json:"created"`
|
||||
Updated time.Time `json:"updated"`
|
||||
@@ -172,12 +174,12 @@ const (
|
||||
)
|
||||
|
||||
type MigrateDataResponseDTO struct {
|
||||
RunID int64 `json:"id"`
|
||||
Items []MigrateDataResponseItemDTO `json:"items"`
|
||||
RunUID string `json:"uid"`
|
||||
Items []MigrateDataResponseItemDTO `json:"items"`
|
||||
}
|
||||
|
||||
type MigrateDataResponseListDTO struct {
|
||||
RunID int64 `json:"id"`
|
||||
RunUID string `json:"uid"`
|
||||
}
|
||||
|
||||
type MigrateDataResponseItemDTO struct {
|
||||
|
||||
Reference in New Issue
Block a user