-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PIMS-1327: Data fixes after seeding Postgres #2191
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
f425508
adjusting evaluation keys and disabling agency seeding
LawrenceLau2020 f4baed0
adjusting fiscal key seed
LawrenceLau2020 28afb1f
adding latest tasks.json ETL task for DBeaver
LawrenceLau2020 1f83d4a
Merge branch 'main' into PIMS-1327
LawrenceLau2020 9d14543
adjusting ETL for users and adding project related tables
LawrenceLau2020 3e21ef5
adding migration for nullable columns adding ETL for project tables
LawrenceLau2020 9f4907d
adding ETL for project_properties
LawrenceLau2020 0d672e7
lint fix
LawrenceLau2020 43e88a1
Merge branch 'main' into PIMS-1327
LawrenceLau2020 6216d4f
added more nullable changes and the final tasks.json
LawrenceLau2020 2eaf796
cleaning up the tasks.json to only have the PIMS ETL task
LawrenceLau2020 19f3cfd
lint fix
LawrenceLau2020 1f8f577
Merge branch 'main' into PIMS-1327
LawrenceLau2020 a5d9e73
Merge branch 'main' into PIMS-1327
LawrenceLau2020 7d89e30
Merge branch 'main' into PIMS-1327
LawrenceLau2020 d6d8f10
updated DBeaver task and nullable columns
LawrenceLau2020 d1770d6
Merge branch 'main' into PIMS-1327
LawrenceLau2020 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
159 changes: 159 additions & 0 deletions
159
express-api/src/typeorm/Migrations/1708536844664-NullableFields.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,159 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class NullableFields1708536844664 implements MigrationInterface { | ||
name = 'NullableFields1708536844664'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE "project" DROP CONSTRAINT "FK_f033e95537c91a7787c7a07c857"`, | ||
); | ||
await queryRunner.query(`DROP INDEX "public"."IDX_7611151947b52a71323a46ea46"`); | ||
await queryRunner.query(`DROP INDEX "public"."IDX_f033e95537c91a7787c7a07c85"`); | ||
await queryRunner.query( | ||
`ALTER TABLE "project" RENAME COLUMN "trier_level_id" TO "tier_level_id"`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "notification_queue" DROP CONSTRAINT "FK_8988a5dafec2270a5191a1208cd"`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "notification_queue" DROP CONSTRAINT "FK_c9230eab8c7df3197b3c96dcac6"`, | ||
); | ||
await queryRunner.query(`DROP INDEX "public"."IDX_e96934a5a81124580dd628602f"`); | ||
await queryRunner.query( | ||
`ALTER TABLE "notification_queue" ALTER COLUMN "project_id" DROP NOT NULL`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "notification_queue" ALTER COLUMN "to_agency_id" DROP NOT NULL`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project_agency_response" DROP CONSTRAINT "FK_67989daa98d90fafc2087a4871f"`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project_agency_response" ALTER COLUMN "notification_id" DROP NOT NULL`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project_property" DROP CONSTRAINT "FK_b2229cb8dfee8d1c2fe6b78bd91"`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project_property" DROP CONSTRAINT "FK_d18ff54ded63e964ef42a66880e"`, | ||
); | ||
await queryRunner.query(`DROP INDEX "public"."IDX_ef992ea03a65f72e0b69644b35"`); | ||
await queryRunner.query( | ||
`ALTER TABLE "project_property" ALTER COLUMN "parcel_id" DROP NOT NULL`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project_property" ALTER COLUMN "building_id" DROP NOT NULL`, | ||
); | ||
await queryRunner.query(`DROP INDEX "public"."IDX_e4998c66591ebea5e8c1c2d575"`); | ||
await queryRunner.query(`ALTER TABLE "project_report" ALTER COLUMN "from" DROP NOT NULL`); | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_88df15c457daadc1d407c6d085" ON "project" ("tier_level_id") `, | ||
); | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_5d29806a012b84ac1d014c563d" ON "project" ("status_id", "tier_level_id", "agency_id") `, | ||
); | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_e96934a5a81124580dd628602f" ON "notification_queue" ("project_id", "template_id", "to_agency_id") `, | ||
); | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_ef992ea03a65f72e0b69644b35" ON "project_property" ("project_id", "property_type_id", "parcel_id", "building_id") `, | ||
); | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_e4998c66591ebea5e8c1c2d575" ON "project_report" ("id", "to", "from", "is_final") `, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project" ADD CONSTRAINT "FK_88df15c457daadc1d407c6d085f" FOREIGN KEY ("tier_level_id") REFERENCES "tier_level"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "notification_queue" ADD CONSTRAINT "FK_8988a5dafec2270a5191a1208cd" FOREIGN KEY ("project_id") REFERENCES "project"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "notification_queue" ADD CONSTRAINT "FK_c9230eab8c7df3197b3c96dcac6" FOREIGN KEY ("to_agency_id") REFERENCES "agency"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project_agency_response" ADD CONSTRAINT "FK_67989daa98d90fafc2087a4871f" FOREIGN KEY ("notification_id") REFERENCES "notification_queue"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project_property" ADD CONSTRAINT "FK_b2229cb8dfee8d1c2fe6b78bd91" FOREIGN KEY ("parcel_id") REFERENCES "parcel"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project_property" ADD CONSTRAINT "FK_d18ff54ded63e964ef42a66880e" FOREIGN KEY ("building_id") REFERENCES "building"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE "project_property" DROP CONSTRAINT "FK_d18ff54ded63e964ef42a66880e"`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project_property" DROP CONSTRAINT "FK_b2229cb8dfee8d1c2fe6b78bd91"`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project_agency_response" DROP CONSTRAINT "FK_67989daa98d90fafc2087a4871f"`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "notification_queue" DROP CONSTRAINT "FK_c9230eab8c7df3197b3c96dcac6"`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "notification_queue" DROP CONSTRAINT "FK_8988a5dafec2270a5191a1208cd"`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project" DROP CONSTRAINT "FK_88df15c457daadc1d407c6d085f"`, | ||
); | ||
await queryRunner.query(`DROP INDEX "public"."IDX_e4998c66591ebea5e8c1c2d575"`); | ||
await queryRunner.query(`DROP INDEX "public"."IDX_ef992ea03a65f72e0b69644b35"`); | ||
await queryRunner.query(`DROP INDEX "public"."IDX_e96934a5a81124580dd628602f"`); | ||
await queryRunner.query(`DROP INDEX "public"."IDX_5d29806a012b84ac1d014c563d"`); | ||
await queryRunner.query(`DROP INDEX "public"."IDX_88df15c457daadc1d407c6d085"`); | ||
await queryRunner.query(`ALTER TABLE "project_report" ALTER COLUMN "from" SET NOT NULL`); | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_e4998c66591ebea5e8c1c2d575" ON "project_report" ("id", "is_final", "from", "to") `, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project_property" ALTER COLUMN "building_id" SET NOT NULL`, | ||
); | ||
await queryRunner.query(`ALTER TABLE "project_property" ALTER COLUMN "parcel_id" SET NOT NULL`); | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_ef992ea03a65f72e0b69644b35" ON "project_property" ("project_id", "property_type_id", "parcel_id", "building_id") `, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project_property" ADD CONSTRAINT "FK_d18ff54ded63e964ef42a66880e" FOREIGN KEY ("building_id") REFERENCES "building"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project_property" ADD CONSTRAINT "FK_b2229cb8dfee8d1c2fe6b78bd91" FOREIGN KEY ("parcel_id") REFERENCES "parcel"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project_agency_response" ALTER COLUMN "notification_id" SET NOT NULL`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project_agency_response" ADD CONSTRAINT "FK_67989daa98d90fafc2087a4871f" FOREIGN KEY ("notification_id") REFERENCES "notification_queue"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "notification_queue" ALTER COLUMN "to_agency_id" SET NOT NULL`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "notification_queue" ALTER COLUMN "project_id" SET NOT NULL`, | ||
); | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_e96934a5a81124580dd628602f" ON "notification_queue" ("project_id", "to_agency_id", "template_id") `, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "notification_queue" ADD CONSTRAINT "FK_c9230eab8c7df3197b3c96dcac6" FOREIGN KEY ("to_agency_id") REFERENCES "agency"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "notification_queue" ADD CONSTRAINT "FK_8988a5dafec2270a5191a1208cd" FOREIGN KEY ("project_id") REFERENCES "project"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project" RENAME COLUMN "tier_level_id" TO "trier_level_id"`, | ||
); | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_f033e95537c91a7787c7a07c85" ON "project" ("trier_level_id") `, | ||
); | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_7611151947b52a71323a46ea46" ON "project" ("agency_id", "trier_level_id", "status_id") `, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "project" ADD CONSTRAINT "FK_f033e95537c91a7787c7a07c857" FOREIGN KEY ("trier_level_id") REFERENCES "tier_level"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, | ||
); | ||
} | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason this column is never used, as I checked in production to confirm there are no references to the Notification Id. Possibly be cause an agency could have more than one notification associated to it.