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

[MIGRATION][NMP#648] catchup on migrations #675

Merged
merged 5 commits into from
Aug 13, 2024

Conversation

acatchpole
Copy link
Contributor

@acatchpole acatchpole commented Aug 2, 2024

Pull Request Standards

  • The title of the PR is accurate
  • The title includes the type of change [HOTFIX, FEATURE, etc]
  • The PR title includes the ticket number in format of [NMP-###]
  • Documentation is updated to reflect change [README, functions, team documents]

Description

When a new migration is created, a model snapshot is used to find all the model changes that do not yet have migration-associated changes. The last migration for NMP was in 2020. A new migration has been created (CatchupModelUpdate) that catches all the model updates that should have already had migrations associated with them.

SNAGS:

In my testing of migrations, the dev db was put into a suboptimal state. the migration history is inaccurate and likely irreconcilable. Currently, it is not possible to run new migrations on the dev db (at least not with the auto-generated migration code). This db will need to be restored to a working state
The production database does not have a record of running the last migration, but the results of that migration are present (the 'Depths' table). This might cause errors when rebuilding prod as the migration will run and it will try to add a table that already exists.

This PR includes the following proposed change(s):

  • Readme on how to create and run migrations
  • a new migration that encompasses all the model changes since 2020

-ALSO INCLUDED: a fix for an issue only affecting one dev. This fix explicitly adds the secret.json to the Configuration object when in a dev env.

@acatchpole acatchpole linked an issue Aug 2, 2024 that may be closed by this pull request
1 task
@acatchpole acatchpole self-assigned this Aug 12, 2024
@acatchpole acatchpole marked this pull request as ready for review August 12, 2024 18:22
Copy link
Contributor

@dallascrichmond dallascrichmond left a comment

Choose a reason for hiding this comment

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

Nice!

@@ -46,6 +46,7 @@ public Startup(IWebHostEnvironment env)

if (env.IsDevelopment())
{
builder.AddJsonFile("secrets.json", optional: true, reloadOnChange: true);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the only real change in this file and it is unrelated to migrations. Adding this line worked as a fix for a hard-to-address local development issue (only one dev had the issue) but it does not seem to have any side effects for working builds.

All other changes in this file are linting

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes I think this is OK as we want to unblock you. I would create a ticket and maybe leave a TODO in the code to pull this out when you offboard from NMP.

@acatchpole acatchpole merged commit 3d372a3 into master Aug 13, 2024
4 checks passed
@acatchpole acatchpole deleted the nmp-648-catchup-on-migrations branch August 13, 2024 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate unapplied migrations
3 participants