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

Check if table exists before trying to create in migrations #10799

Merged
merged 1 commit into from
Mar 8, 2022

Conversation

snipe
Copy link
Owner

@snipe snipe commented Mar 8, 2022

This is a fringe case, and I'm still not 100% sure why it happens sometimes but not all the time, usually with customers who have given us a backup and they wish to migrate to hosted. Somehow the migration tables get mangled where they don't actually register a few of the migrations, so they keep trying to re-run them, which means the migrations never complete.

This change targets those specific files that seem to fail in these circumstances and checks to make sure the table doesn't already exist before trying to create it.

You're welcome, @uberbrady :)

Signed-off-by: snipe [email protected]

@snipe snipe changed the title Check if table exists before trying to create Check if table exists before trying to create in migrations Mar 8, 2022
Copy link
Collaborator

@uberbrady uberbrady left a comment

Choose a reason for hiding this comment

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

I think this happens when customers set up a new server, then load up their old data onto the new server (without wiping the DB first). That means they have new schema with some old data. Fun times.

This fix looks GREAT - I'm sure it will help the next weird 'mangled' restore we have to do!

@snipe snipe merged commit ed39df3 into master Mar 8, 2022
@snipe snipe deleted the fixes/check_if_tables_exist_before_trying_to_create branch March 8, 2022 04:22
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