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

Add checks before removing old notes or params_yaml columns #7647

Merged
merged 2 commits into from
Mar 22, 2023

Conversation

gbp
Copy link
Member

@gbp gbp commented Mar 17, 2023

Relevant issue(s)

Connected to #6949

What does this do?

Add checks before removing old notes or params_yaml columns.

Why was this needed?

If a re-user skips 0.42.0.0 upgrade notes then they could lose data. Add a check to ensure we prevent this.

Screenshots

> rails db:migrate
snip
== 20220902112339 RemovePublicBodyNotes: migrating ============================
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

We can't run the RemovePublicBodyNotes database migration.

We have dectected PublicBody::Translation objects which haven't been
migrated to the new Note model.

Please deploy Alaveteli 0.42.0.0 and run the upgrade tasks:
https://github.com/mysociety/alaveteli/blob/0.42.0.0/doc/CHANGES.md#upgrade-notes

./alaveteli/db/migrate/20220902112339_remove_public_body_notes.rb:4:in `up'
> rails db:migrate
snip
== 20230127132719 RemoveInfoRequestEventParamsYaml: migrating =================
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

We can't run the RemoveInfoRequestEventParamsYaml database migration.

We have dectected InfoRequestEvent objects which haven't been migrated
to the new JSONB params column.

Please deploy Alaveteli 0.42.0.0 and run the upgrade tasks:
https://github.com/mysociety/alaveteli/blob/0.42.0.0/doc/CHANGES.md#upgrade-notes

./alaveteli/db/migrate/20230127132719_remove_info_request_event_params_yaml.rb:4:in `up'

@gbp gbp force-pushed the add-param-yaml-migration-check branch from e0361b3 to fe27d2f Compare March 17, 2023 19:06
@gbp gbp changed the title Add check before removing params_yaml column Add checks before removing old notes or params_yaml columns Mar 17, 2023
@gbp gbp mentioned this pull request Mar 20, 2023
16 tasks
gbp added 2 commits March 20, 2023 10:57
Check for content in InfoRequestEvent#params_yaml column.

If a re-user skips 0.42.0.0 upgrade notes then they could lose data. Add
a check to ensure we prevent this.
Check for content in PublicBody::Translation#notes column.

If a re-user skips 0.42.0.0 upgrade notes then they could lose data. Add
a check to ensure we prevent this.
@gbp gbp force-pushed the add-param-yaml-migration-check branch from fe27d2f to 031bdcd Compare March 20, 2023 10:58
@gbp gbp merged commit f16443b into develop Mar 22, 2023
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.

1 participant