From 8c0fde121333d9d80340201b6f2202e6143e4e8a Mon Sep 17 00:00:00 2001 From: Daniel Haselhan Date: Mon, 29 Jan 2024 11:49:37 -0800 Subject: [PATCH] Migrate existing Applications --- .../1706056918403-remove_dupe_govs.ts | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/services/apps/alcs/src/providers/typeorm/migrations/1706056918403-remove_dupe_govs.ts b/services/apps/alcs/src/providers/typeorm/migrations/1706056918403-remove_dupe_govs.ts index 67a6743a65..784ae5162a 100644 --- a/services/apps/alcs/src/providers/typeorm/migrations/1706056918403-remove_dupe_govs.ts +++ b/services/apps/alcs/src/providers/typeorm/migrations/1706056918403-remove_dupe_govs.ts @@ -4,21 +4,41 @@ export class RemoveDupeGovs1706056918403 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { //City of Port Alberni await queryRunner.query(` - DELETE FROM "alcs"."local_government" WHERE "uuid" = 'b8a622d7-66da-4598-9687-2e8727fb2561'; + UPDATE "alcs"."application" SET "local_government_uuid" = '1b9887fd-617d-4aef-891c-41dd2ad50d4b' WHERE "local_government_uuid" = 'b8a622d7-66da-4598-9687-2e8727fb2561'; + UPDATE "alcs"."notice_of_intent" SET "local_government_uuid" = '1b9887fd-617d-4aef-891c-41dd2ad50d4b' WHERE "local_government_uuid" = 'b8a622d7-66da-4598-9687-2e8727fb2561'; + UPDATE "alcs"."planning_review" SET "local_government_uuid" = '1b9887fd-617d-4aef-891c-41dd2ad50d4b' WHERE "local_government_uuid" = 'b8a622d7-66da-4598-9687-2e8727fb2561'; + UPDATE "alcs"."covenant" SET "local_government_uuid" = '1b9887fd-617d-4aef-891c-41dd2ad50d4b' WHERE "local_government_uuid" = 'b8a622d7-66da-4598-9687-2e8727fb2561'; + + DELETE FROM "alcs"."local_government" WHERE "uuid" = 'b8a622d7-66da-4598-9687-2e8727fb2561'; `); //District of Barriere await queryRunner.query(` + UPDATE "alcs"."application" SET "local_government_uuid" = 'a7e16ffa-a218-4f8c-9695-9642a9987e3b' WHERE "local_government_uuid" = 'd3f74ba5-0dc3-43ea-a7e2-004882d65c33'; + UPDATE "alcs"."notice_of_intent" SET "local_government_uuid" = 'a7e16ffa-a218-4f8c-9695-9642a9987e3b' WHERE "local_government_uuid" = 'd3f74ba5-0dc3-43ea-a7e2-004882d65c33'; + UPDATE "alcs"."planning_review" SET "local_government_uuid" = 'a7e16ffa-a218-4f8c-9695-9642a9987e3b' WHERE "local_government_uuid" = 'd3f74ba5-0dc3-43ea-a7e2-004882d65c33'; + UPDATE "alcs"."covenant" SET "local_government_uuid" = 'a7e16ffa-a218-4f8c-9695-9642a9987e3b' WHERE "local_government_uuid" = 'd3f74ba5-0dc3-43ea-a7e2-004882d65c33'; + DELETE FROM "alcs"."local_government" WHERE "uuid" = 'd3f74ba5-0dc3-43ea-a7e2-004882d65c33'; `); //District of Fort St. James await queryRunner.query(` + UPDATE "alcs"."application" SET "local_government_uuid" = 'b89df1ef-9b1d-494e-8387-b1ba6abaf637' WHERE "local_government_uuid" = 'e0684ddf-fa61-47c2-87b3-1c72bed5c365'; + UPDATE "alcs"."notice_of_intent" SET "local_government_uuid" = 'b89df1ef-9b1d-494e-8387-b1ba6abaf637' WHERE "local_government_uuid" = 'e0684ddf-fa61-47c2-87b3-1c72bed5c365'; + UPDATE "alcs"."planning_review" SET "local_government_uuid" = 'b89df1ef-9b1d-494e-8387-b1ba6abaf637' WHERE "local_government_uuid" = 'e0684ddf-fa61-47c2-87b3-1c72bed5c365'; + UPDATE "alcs"."covenant" SET "local_government_uuid" = 'b89df1ef-9b1d-494e-8387-b1ba6abaf637' WHERE "local_government_uuid" = 'e0684ddf-fa61-47c2-87b3-1c72bed5c365'; + DELETE FROM "alcs"."local_government" WHERE "uuid" = 'e0684ddf-fa61-47c2-87b3-1c72bed5c365'; `); //District of Hudson’s Hope await queryRunner.query(` + UPDATE "alcs"."application" SET "local_government_uuid" = 'df19457c-4511-4104-bc85-9675412a6359' WHERE "local_government_uuid" = '79c3e16e-fdb9-4bb0-a427-f044a5d4bb95'; + UPDATE "alcs"."notice_of_intent" SET "local_government_uuid" = 'df19457c-4511-4104-bc85-9675412a6359' WHERE "local_government_uuid" = '79c3e16e-fdb9-4bb0-a427-f044a5d4bb95'; + UPDATE "alcs"."planning_review" SET "local_government_uuid" = 'df19457c-4511-4104-bc85-9675412a6359' WHERE "local_government_uuid" = '79c3e16e-fdb9-4bb0-a427-f044a5d4bb95'; + UPDATE "alcs"."covenant" SET "local_government_uuid" = 'df19457c-4511-4104-bc85-9675412a6359' WHERE "local_government_uuid" = '79c3e16e-fdb9-4bb0-a427-f044a5d4bb95'; + DELETE FROM "alcs"."local_government" WHERE "uuid" = '79c3e16e-fdb9-4bb0-a427-f044a5d4bb95'; `);