-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1914 from bcgov/hotfix/ALCS-2295
Fix Missing NARU Proposed/Existing Residence Data for Files After the Migration
- Loading branch information
Showing
10 changed files
with
203 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...iders/typeorm/migrations/1728581017573-convert_naru_floor_area_and_existing_structuers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class ConvertNaruFloorAreaAndExistingStructuers1728581017573 | ||
implements MigrationInterface | ||
{ | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
UPDATE alcs.application_submission as2 | ||
SET naru_existing_residences = jsonb_build_array( | ||
jsonb_build_object( | ||
'floorArea', 0, | ||
'description', as2.naru_existing_structures | ||
) | ||
) | ||
WHERE as2.naru_existing_structures IS NOT NULL; | ||
`); | ||
|
||
await queryRunner.query(` | ||
UPDATE alcs.application_submission as2 | ||
SET naru_proposed_residences = jsonb_build_array( | ||
jsonb_build_object( | ||
'floorArea', (as2.naru_floor_area::float) , | ||
'description', '' | ||
) | ||
) | ||
WHERE as2.naru_floor_area IS NOT NULL; | ||
`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
UPDATE alcs.application_submission as2 | ||
SET naru_existing_residences = '[]'::jsonb | ||
WHERE as2.naru_existing_structures IS NOT NULL; | ||
`); | ||
|
||
await queryRunner.query(` | ||
UPDATE alcs.application_submission as2 | ||
SET naru_proposed_residences = '[]'::jsonb | ||
WHERE as2.naru_floor_area IS NOT NULL; | ||
`); | ||
} | ||
} |