-
Notifications
You must be signed in to change notification settings - Fork 696
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
fix: Fix tables creation depending on each other via foreignKey constraint #1649
fix: Fix tables creation depending on each other via foreignKey constraint #1649
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @naftalmm. Thank you for your contribution. Could you please rebase on the main
branch?
53f9cff
to
cf1f837
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution, lgtm! please consider adding a test
...test/kotlin/org/jetbrains/exposed/sql/tests/shared/ddl/CreateMissingTablesAndColumnsTests.kt
Outdated
Show resolved
Hide resolved
@naftalmm Thanks for adding tests. Could you please rebase on the |
…: fix table sorting by references, simplify code
915c1bd
to
7f653d7
Compare
…raint (JetBrains#1649) * fix tables creation depending on each other via foreignKey constraint: fix table sorting by references, simplify code * add tests in case there are two tables (parent and child), with the child table referring the parent by the means of a composite foreign key only, the reference is not taken into account by the call SchemaUtils.create and, subsequently, by SchemaUtils.sortTablesByReferences this causes the SchemaUtils to try to create the child table first, resulting in an SQL error: CREATE TABLE IF NOT EXISTS child ..., CONSTRAINT fk_name FOREIGN KEY (col1, col2) REFERENCES parent(col1 col2) ... [42102-199]. Statement(s): ... Table parent not found --------- Co-authored-by: Jocelyne <[email protected]>
This PR fixes #1643