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

Wrong table creation order causes migration failure (but not in SQLite) #6977

Open
AlessandroSechi opened this issue Apr 18, 2024 · 1 comment
Assignees
Labels
type:with reproduction steps with reproduction steps

Comments

@AlessandroSechi
Copy link

GORM Playground Link

go-gorm/playground#721

Description

Migration succeed on SQLITE, but fails on other DBs due to wrong order in tables creation (cities is created before regions). Apparently even in SQLITE order is wrong (but not sure how logging is handled), but it succedes.

@AlessandroSechi
Copy link
Author

The issue seems to be that there's circular dependency between tables. I think in this case GORM should automatically defer foreign keys creation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:with reproduction steps with reproduction steps
Projects
None yet
Development

No branches or pull requests

2 participants