diff --git a/api/apps/api/src/migrations/api/1694192071502-AddScenarioToCostSurfaceAPIRelationship.ts b/api/apps/api/src/migrations/api/1694192071502-AddScenarioToCostSurfaceAPIRelationship.ts index 8d8903f0f0..8b9d7d93b5 100644 --- a/api/apps/api/src/migrations/api/1694192071502-AddScenarioToCostSurfaceAPIRelationship.ts +++ b/api/apps/api/src/migrations/api/1694192071502-AddScenarioToCostSurfaceAPIRelationship.ts @@ -42,10 +42,10 @@ async function costSurfaceMigrationUp(queryRunner: QueryRunner): Promise { // Create Cost Surface per Scenario and link them for (const scenario of scenarios) { const costSurface: { id: string }[] = await apiQueryRunner.query( - `INSERT INTO cost_surfaces (id, name, min, max, is_default, project_id) - VALUES (gen_random_uuid(), $1, 0, 0, false, $2) + `INSERT INTO cost_surfaces (id, name, min, max, is_default, project_id, is_migrated) + VALUES (gen_random_uuid(), $1, 0, 0, false, $2, true) RETURNING id;`, - [`MIGRATED - ${scenario.name} Cost Surface`, scenario.project_id], + [`${scenario.name} Cost Surface`, scenario.project_id], ); await apiQueryRunner.query( @@ -65,9 +65,9 @@ async function costSurfaceMigrationUp(queryRunner: QueryRunner): Promise { for (const project of projects) { await apiQueryRunner.query( - `INSERT INTO cost_surfaces (id, name, min, max, is_default, project_id) - VALUES (gen_random_uuid(), $1, 0, 0, true, $2);`, - [`MIGRATED - Default Cost Surface`, project.id], + `INSERT INTO cost_surfaces (id, name, min, max, is_default, project_id, is_migrated) + VALUES (gen_random_uuid(), $1, 0, 0, true, $2, true);`, + [`Default Cost Surface`, project.id], ); } @@ -76,7 +76,6 @@ async function costSurfaceMigrationUp(queryRunner: QueryRunner): Promise { await geoQueryRunner.query(`ALTER TABLE cost_surface_pu_data DROP CONSTRAINT if exists cost_surface_pu_data_puid_key; ALTER TABLE cost_surface_pu_data ADD CONSTRAINT unique_cost_surface_puid UNIQUE (cost_surface_id, puid);`); - const updatedScenarios: { id: string; cost_surface_id: string;