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

Fixes #33936 - Delete Pools with null subscription_id before adding not-null constraint #9791

Merged
merged 1 commit into from Nov 17, 2021

Conversation

jturel
Copy link
Member

@jturel jturel commented Nov 16, 2021

What are the changes introduced in this pull request?

Corrects a DB migration to delete Pools having a null subscription ID (this is safe - they are effectively orphaned) before running the rest of the migration that says "subscription ID can't be nil"

What is the thinking behind these changes?

Failed DB migrations == Bad
Working DB migrations == Good

What are the testing steps for this pull request?

Hmm, I recommend simply evaluating that the code change will meet the requirements I've described here otherwise I'm open to ideas as testing the entire upgrade process seems a bit extreme for this :)

Notice that the migration already handled this case for null organization_id but missed subscription ID. Oops!

@theforeman-bot
Copy link

Issues: #33936

Copy link
Member

@jeremylenz jeremylenz left a comment

Choose a reason for hiding this comment

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

Makes sense to me!

Is it safer to add a new migration instead of editing this one? That way users who hit this issue could simply run migrations to fix it.

@jturel
Copy link
Member Author

jturel commented Nov 17, 2021

Is it safer to add a new migration instead of editing this one? That way users who hit this issue could simply run migrations to fix it.

At the end of the day something needs to be cherry-picked back to get the migrations passing for those hitting this bug ie running the migrations again is necessary either way. A new migration would be executed last without changing the filename in order to insert it before the one I've changed here. That seems a bit odd especially since it incurs a new migration for those who have already ran the one I edited here successfully. If the case were that the original migration passed but put the db into a bad state then that would be the right time for a new migration to correct the broken data.

Copy link
Member

@jeremylenz jeremylenz left a comment

Choose a reason for hiding this comment

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

makes sense, thanks @jturel !

@jturel jturel merged commit a8a7580 into Katello:master Nov 17, 2021
@jturel jturel deleted the fix_subscription_null_migration branch November 17, 2021 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants