-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 H2 database case-sensitive identifier issues + upgrades JUnit tests cases to version 5 #4052
Fix H2 database case-sensitive identifier issues + upgrades JUnit tests cases to version 5 #4052
Conversation
Initial review: Thanks for the fix, and the other general cleanup in there to, @mches . I appreciate the separate commits for each step you did. The conversion to JUnit 5 tests is nice. We've generally been converting from junit 4 tests to spock tests, but that takes time for each existing test when there is just a small change you'd like to make. Having them be the nicer junit 5 will help the times when it's not a good time to redo the whole test, but still want to take advantage of nicer syntax. I also like the separate reserved word list for v1 vs v2. That helps us support both versions, which we need to continue doing. In your last commit, you override Things to be aware of:
|
Thank you for your time and feedback @nvoxland. Of course you're right about the purpose of each of the methods. I took that to heart and came up with a better organization of the logic. Hope you like it. |
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.
This PR is restoring compatibility with H2 1.x reserved words, and as an "extra" it also upgrades JUnit tests cases to version 5.
Thanks for those fix and improvements @mches . Also, I added some "merge branch master" commits - please feel free to rebase to get rid of them .
Resolved the conflict in |
Rebased onto latest |
Thanks for the rebase! I'll get it merged today. |
How do we take this change out for a test ride before the release? Should I be able to get it from Github packages without an access token for your repo? |
Hey @nealeu , are you able to download it from here -> https://github.com/liquibase/liquibase/suites/15586269682/artifacts/891121515 ? |
My H2 database has a table with one of the column name - I tried adding below line in the changeset, but its not working.
|
Liquibase is uppercasing the reserved word <changeSet …>
…
<modifySql>
<regExpReplace replace=""KEY"" with=""key""/>
</modifySql>
</changeSet> If you want to preserve the case of every identifier, then use someting like this. <changeSet … objectQuotingStrategy="QUOTE_ALL_OBJECTS">
…
</changeSet> |
@mches thanks for providing solutions! |
@shrralis Yes, whether a bug or undocumented limitation, Liquibase doesn't seem to apply SQL visitors like Knowing that limitiation, you may be able to work around it with something like this, but in some cases prepared statements are required. <changeSet …>
<loadData … usePreparedStatements="false"/>
<modifySql>
<regExpReplace replace=""KEY"" with=""key""/>
</modifySql>
</changeSet> You could also use object quoting strategy, but then also uppercase the CSV file's headers other than the illegal identifiers. <changeSet … objectQuotingStrategy="QUOTE_ALL_OBJECTS">
<loadData …/>
</changeSet>
|
Impact
Description
On H2,
objectQuotingStrategy
on the change log or change set,liquibase.preserveSchemaCase
configuration property,modifySql
, or extension.Fixes #2385
Fixes #3289
Things to be aware of
.git-blame-ignore-revs
.tap
closure.*Spec
, as a seprate commit.H2DatabaseTest
canH2DatabaseSpec
to coexist, so that the existing test doesn't have to be renamed or converted, along with it's class hierachy, to free up the name.Things to worry about
Some existing users' change sets or databases may require modification if they're targeting a long-lived embedded H2 database and have chosen names that require implicit quoting such as reserved words, e.g.
user
,group
,groups
, orvalue
, or names with spaces.Additional Context
Spring Boot users upgrading to 2.7.x and using jOOQ Open Source Edition often have to downgrade H2 to 1.4.x. See spring-projects/spring-boot#31168, https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.7-Release-Notes#jooq.
If desired, I can create separate PRs for
objectQuotingStrategy