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 Reversion Breaks with Foreign Keys #341

Open
dakotacookenmaster opened this issue Jun 24, 2021 · 0 comments
Open

Migration Reversion Breaks with Foreign Keys #341

dakotacookenmaster opened this issue Jun 24, 2021 · 0 comments

Comments

@dakotacookenmaster
Copy link

dakotacookenmaster commented Jun 24, 2021

Creating and running the migrations from models works like a charm (thank you!), but the migration reversion is broken when foreign key constraints apply. The generated actions summary shows that the first tables created are ones with no dependencies, and the ones created following that use those as dependencies (this makes sense).

Here's an example structure:

image

However, it appears that the order in which tables are dropped does not match this. Instead, it goes alphabetically (either implicitly, because of how files are sorted in the file system, or explicitly).

Here's a small example of the rollbackCommands applied to:

image

For migration reversion to work appropriately, first the tables with dependencies must be dropped. If reversion happens in the reverse order they were created, this problem would be solved.

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

No branches or pull requests

1 participant