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
Fixed MySQLProfile drop SQL commands to use qualified schema+table names #1898
Fixed MySQLProfile drop SQL commands to use qualified schema+table names #1898
Conversation
@NicolasRouquette Could you also add a test case that failes without the change and then works with it. |
@NicolasRouquette What will happen if I jsut define the tablename and I didn‘t defined the schema name? I have to avoid to define schema in my codegen script in my code. And what will it happen? |
@djx314 The fix ensures that SQL statements produced for dropping foreign keys use the same qualified name mechanism as that used for producing other kinds of SQL statements (e.g., create/drop table). So, if you use unqualified table names without a schema name, then all SQL statements should be correspondingly unqualified table names as before. The fix does not change this behavior. |
@hvesalai I'm converting my example (https://github.com/NicolasRouquette/MySQLSlickTest) into a new unit test: |
- Reverted the fix for slick#1898 to force MySQLQualifiedExtraTests to fail - Updated ForeignKeyTest to drop schema tables (if run on MySQL, it would be MySQLUnqualifiedExtraTests)
- Removed duplicate drop in ForeignKeyTest
@hvesalai The test could be much simpler than I though. I am refactoring
Hopefully, this will work to demonstrate the bug. |
Looks, good, but now you pushed the revert of the fix also... can you rebase and rework (see documentation of git rebase -i) the four commits so there are only two:
You can then force push the result to replace the commits now in this PR with these two. |
@hvesalai I'll rewrite the history after I manage to get the qualified tests to fail as intended. I have problems creating SQL statements for
How should it be written so that it produces SQL statements like this: |
Why can't use use sql interpolation or StaticQuery.updateNA |
All the QualifiedForeignKey tests fail. Looking at the test failures, there is no common syntax for creating a database (aka schema) that will work across all implementations. It seems that slick would have to add support for this and specify in an implementation specific profile the corresponding syntax for the SQL statement(s) to produce. |
@NicolasRouquette there are some test cases failing now. Do you have time to check it out and try to fix the code. |
@NicolasRouquette I'm going throught the PRs that I will include in the next 3.3. release. Do you think this could make it, i.e. can it be fixed? |
@hvesalai Sorry for the delay in responding. The fix is really simple; unfortunately, making a test that demonstrates the problem is more difficult because this seems to be the first time that there is a test involving "create/drop schema/table" I'm not sure how to proceed. |
@NicolasRouquette do you think this can be closed in favor of #1928 by @smootoo |
This might now be obsolete. |
Agreed. I think this can be closed now, so I'm going to close it. Please re-open, if required. |
Fixes #1897