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

fix: add safety checks on migration script #431

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

ludtkemorgan
Copy link
Collaborator

After merging the jurisdictional refactor PR the following error happened when running the migration in the staging environment


/app/src/migration/1695143897902-add-jurisdictions.ts:41
--
existingListings.forEach(async (listing) => {
                 ^
TypeError: Cannot read properties of undefined (reading 'id')
  at /app/src/migration/1695143897902-add-jurisdictions.ts:42:97
  at Array.forEach (<anonymous>)
  at addJurisdictions1695143897902.up (/app/src/migration/1695143897902-add-jurisdictions.ts:41:22)

This is most likely because there are listings in the staging environment that don't have a county associated to them. This change does a check to make sure the matching jurisdiction exists before doing anything to the listing.

this means that there might be some properties still tied to the bayArea jurisdiction, but we can manually update those if necessary

How Can This Be Tested/Reviewed?

The script should still run as before and you can use the instructions here to test: #377

Checklist:

  • My code follows the style guidelines of this project
  • I have added QA notes to the issue with applicable URLs
  • I have performed a self-review of my own code
  • I have reviewed the changes in a desktop view
  • I have reviewed the changes in a mobile view
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have assigned reviewers
  • I have run yarn generate:client and/or created a migration if I made backend changes that require them
  • My commit message(s) is/are polished, and any breaking changes are indicated in the message and are well-described
  • Commits made across packages purposefully have the same commit message/version change, else are separated into different commits

Reviewer Notes:

Steps to review a PR:

  • Read and understand the issue, and ensure the author has added QA notes
  • Review the code itself from a style point of view
  • Pull the changes down locally and test that the acceptance criteria is met
  • Also review the acceptance criteria on the Netlify deploy preview (noting that these do not yet include any backend changes made in the PR)
  • Either explicitly ask a clarifying question, request changes, or approve the PR if there are small remaining changes but the PR is otherwise good to go

On Merge:

If you have one commit and message, squash. If you need each message to be applied, rebase and merge.

Copy link
Collaborator

@ColinBuyck ColinBuyck left a comment

Choose a reason for hiding this comment

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

LGTM 🐨

@ColinBuyck ColinBuyck added the ready to merge Should be applied when a PR has been reviewed and approved label Dec 1, 2023
@ludtkemorgan ludtkemorgan merged commit 5330f01 into main Dec 1, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Should be applied when a PR has been reviewed and approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants