CloudMigrations: Break snapshot resources out into their own table (#89575)
* create a new table for migration resources * remove raw result bytes from db * more snapshot resource management stuff * integrate new table with snapshots * pass in result limit and offset as params * combine create and update * set up xorm store test * add unit tests * save some cpu * remove unneeded arg * regen swagger * fix bug with result processing * fix update create logic so that uid isn't required for lookup * change offset to page * regen swagger * revert accidental changes to file * curl command page should be 1 indexed
This commit is contained in:
@@ -139,4 +139,23 @@ func addCloudMigrationsMigrations(mg *Migrator) {
|
||||
|
||||
errorStringColumn := Column{Name: "error_string", Type: DB_Text, Nullable: true}
|
||||
mg.AddMigration("add snapshot error_string column", NewAddColumnMigration(migrationSnapshotTable, &errorStringColumn))
|
||||
|
||||
// --- create table for tracking resource migrations
|
||||
migrationResourceTable := Table{
|
||||
Name: "cloud_migration_resource",
|
||||
Columns: []*Column{
|
||||
{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
|
||||
{Name: "uid", Type: DB_NVarchar, Length: 40, Nullable: false},
|
||||
{Name: "resource_type", Type: DB_NVarchar, Length: 40, Nullable: false},
|
||||
{Name: "resource_uid", Type: DB_NVarchar, Length: 40, Nullable: false},
|
||||
{Name: "status", Type: DB_NVarchar, Length: 20, Nullable: false},
|
||||
{Name: "error_string", Type: DB_Text, Nullable: true},
|
||||
{Name: "snapshot_uid", Type: DB_NVarchar, Length: 40, Nullable: false},
|
||||
},
|
||||
}
|
||||
|
||||
mg.AddMigration("create cloud_migration_resource table v1", NewAddTableMigration(migrationResourceTable))
|
||||
|
||||
// -- delete the snapshot result column while still in the experimental phase
|
||||
mg.AddMigration("delete cloud_migration_snapshot.result column", NewRawSQLMigration("ALTER TABLE cloud_migration_snapshot DROP COLUMN result"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user