-
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 getting ENUM column values from Mysql database having multiple schemas #2616
Conversation
…hemas with same table name and column name
Code Review Notes: Things to be aware of
Things to worry about
|
… into akatiyar-fix_enum_values
For this PR I checked that the changelogs were generated with the correct values for the ENUM defined in the table column. I also verified this in the output of the snapshot command. First, I created the schemas 'test' and 'test2' and a table with a column of type ENUM in each of them:
After that I checked the following items: MariaDB
MySQL
This is the output of generateChangelog command in SQL format:
And this is the output of the snapshot command in JSON format:
The rest of the outputed files can be found in this file inside the folder 'postFix': |
Fixes #2594 - getting ENUM column values from Mysql database having multiple schemas with same table name and column name.
Environment
Liquibase Version: 4.8.0 (PR is from Master branch)
Liquibase Integration & Version: Maven
Liquibase Extension(s) & Version: NA
Database Vendor & Version: MySQL
Operating System Type & Version: Mac
Pull Request Type
Description
In MySQL, if DB has 2 schemas say db1 and db2. If both db1 and db2 have a table with the same name, stay example_table. And if table in both schemas has a column with same name (say example_column) of type ENUM with different ENUM values, generate-changelog on db1 (or db2) returns a union of values from db1.example_table.example_column and db2.example_table.example_column.
This PR fixes it by adding a check on TABLE_SCHEMA in the where clause to retrieve ENUM values.
Steps To Reproduce
Now if you run liquibase to generate the changelog for either of db1 or db2, it shows ENUM values for the column from both db1 and db2.
Actual Behavior
See Steps To Reproduce section above.
Expected/Desired Behavior
See Steps To Reproduce section above.
Screenshots (if appropriate)
If applicable, add screenshots to help explain your problem.
Additional Context
Add any other context about the problem here.
Fast Track PR Acceptance Checklist:
Need Help?
Come chat with us on our discord channel