Skip to content
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 17 commits into from
Feb 22, 2024
Merged

PIMS-1327: Data fixes after seeding Postgres #2191

merged 17 commits into from
Feb 22, 2024

Conversation

LawrenceLau2020
Copy link
Collaborator

@LawrenceLau2020 LawrenceLau2020 commented Feb 15, 2024

🎯 Summary

PIMS-1327:

This PR adjusts some of the evaluation key and fiscal key seeds and disables the agency seeding which is replaced with ETL of the agencies based on SQL queries because of the differences in agencies across all environments.

First step you need to do is to "revert" all the data migrations that have been run by running this command in the express-api folder, you may need to do this 3 or 4 times depending on how many migrations you have in your migrations table:
npm run migration revert

The very last "revert" should be the one that DROPS all the tables so you're starting from scratch.

Then run the data migration to "re-seed" the tables again as well as run the other migration changes:
npm run migration run

Then the next step is running an ETL task in DBeaver, but before you run the ETL task in DBeaver, copy the attached tasks.json file to the following location:
Windows users will need to locate the existing tasks.json file in their AppData folder here:
"C:\Users\YOUR_USER_NAME\AppData\Roaming\DBeaverData\workspace6\General\.dbeaver"
Mac users are slightly different:, see: https://dbeaver.com/docs/dbeaver/Workspace-Location/
~/Library/DBeaverData/

If the above location doesn't exist you can create a "test" task in your DBeaver application to get this folder location going if it doesn't already exist after having installed DBeaver. Otherwise just replace the existing tasks.json file with the one in this PR.

You can test this by running the "PIMS ETL" task which should import agencies, users, parcels and buildings, Parcel and building evaluations, as well as parcel_buildings and parcel_fiscals, and projects. As more project related tables are included in the ETL there might be a few more data fixes.

Note: the ETL task that you need to run is the one highlighted in yellow below, located within the "PIMS ETL" folder:
image

This will populate all the tables in the Postgres database that were not "seeded".
Once #2190 gets merged, there will be some changes needed in each of the ETL "jobs" to incorporate the new column name changes in that ticket.

🔰 Checklist

  • I have read and agree with the following checklist and am following the guidelines in our Code of Conduct document.
  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation where required.
  • I have tested my changes to the best of my ability.
  • My changes generate no new warnings.

Copy link

codeclimate bot commented Feb 15, 2024

Code Climate has analyzed commit d1770d6 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 91.1%.

View more on Code Climate.

Copy link

🚀 Deployment Information

The API Image has been built with the tag: 2191. Please make sure to utilize this specific tag when promoting these changes to the TEST and PROD environments during the API deployment. For more updates please monitor Image Tags Page on Wiki.

dbarkowsky
dbarkowsky previously approved these changes Feb 15, 2024
@dbarkowsky dbarkowsky self-requested a review February 16, 2024 18:54
@dbarkowsky dbarkowsky dismissed their stale review February 16, 2024 18:54

PR has changed quite a bit since last review.

@@ -26,7 +26,7 @@ export class ProjectAgencyResponse extends BaseEntity {
OfferAmount: number;

// Notification Relation
@Column({ name: 'NotificationId', type: 'int' })
@Column({ name: 'NotificationId', type: 'int', nullable: true })
NotificationId: number;
Copy link
Collaborator Author

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.

Copy link
Collaborator

@dbarkowsky dbarkowsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested from scratch, running migrations then ETL.
Everything worked as expected. My Postgres tables are populated with data from the MS SQL Server.

@LawrenceLau2020 LawrenceLau2020 merged commit e0efa9b into main Feb 22, 2024
5 checks passed
@LawrenceLau2020 LawrenceLau2020 deleted the PIMS-1327 branch February 22, 2024 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants