Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Moved the "select the index metadata" SQL from the driver to our code so that we can also pull from the new column if we have a new enough database.
Fixes #1626 as well as generally snapshots indexes with functions correctly now.
Impact
On Mysql 8.0.13+ create a table and index like:
When running
liquibase snapshot
you now see the idx_test index.On older mysql versions, you can't create the index with the lower(first_name) function, but an index like
create index idx_test on my_table(first_name);
is still correctly found without a SQL error.Because this snapshot functionality works now, the reported indexExists precondition works as well.
Dev Handoff Notes (Internal Use)
Links
Testing
Dev Verification
Tested snapshot and precondition check on both the latest mysql 8 and 5.7 versions
Test Requirements (Liquibase Internal QA)
Testing this ticket requires a MySQL 5.7 instance and a MySQL 8 instance. One test case will require a Pro license to validate the JSON snapshot feature correctly gathers the function index.
Manual Tests
Setup the SQL in
Verify snapshot of a MySQL 8 database includes an index that uses a function.
liquibase --output-file mysql8-snapshot.txt snapshot
Pro: Verify JSON formatted snapshot of a MySQL 8 database includes the
liquibase --output-file mysql8-pro-snapshot.json snapshot --snapshot-format JSON
Verify validate of an indexExists precondition correctly identifies existence of an index that uses a function.
liquibase --log-level INFO validate--changelog-file lb2160-changelog.xml
Validation Error:
1 preconditions failed
lb2160-changelog.xml : index idx_lb2160 already exists
Liquibase command 'validate' was executed successfully.