-
Notifications
You must be signed in to change notification settings - Fork 695
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
Foreign Key Constraints being recreated #394
Comments
@Togrias , could you please share your Table mapping and which database do you use? |
I am also running into this. Here is a quick example that triggers it:
I am using MySQL 5.7 |
@platky , could you also specify which jdbc driver version do you use? |
I'm using the MySQL Connector which seems to have JDBC version 4.2. Using the above dependency instead of just creating duplicate fk's, it throws an exception and crashes:
Also just in case, I am triggering it like this:
|
Still can't reproduce on clean mysql 5.7 with jdbc connector 8.0.13. |
I haven't gotten a chance to test extensively, but I'm using postgresql. Could this be due to case-sensitivity issues with the generated constraint names? IIRC postgres names are case sensitive but mysql names aren't (?).
Also, uniqueIndex(...) throws an error when updating tables vis createMissingTablesAndColumns(), because it will attempt to create the constraint a second time, which fails due to naming conflicts. I'll update when I get a chance. |
Fixed in master, will be released soon. |
Hi, I can confirm that the case-sensitivity issue is causing it. Renaming columns to lower-case fixed the issue for Postgresql 9.1. |
Please, check release 0.11.1. |
Hi, I don't think the issue has been resolved for Postgresql. The function now throws an error rather than creating duplicate keys. |
Hi, I think I am running into the same problem. With:
the second createMissingTables...() fails with
Before running all tables have been droped. |
I'm having the same issue, after debugging I noticed that it is being caused by a case-sensitive check here:
The indexes are created correctly by the createStatements() method but exposed attempts to recreate it at addMissingColumnsStatements() because it's ignoring the references when the table have capital letters @StefanHUB has a work around, name all your tables manually with lower cased names object Customers : Table("customers") {
//...
} |
@joserobjr Thanks! |
Hi,
When using uniqueIndex() or init { index(true, ...) }, createMissingTablesAndColumns seems to add additional constraints each time it is run. How do we avoid this?
The text was updated successfully, but these errors were encountered: