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
Include columnDataType in generated setColumnRemarks changesets #2188
Conversation
…ge Log Generation
Hi @coylecullen Thanks for creating this PR. A member of the Liquibase team will take a look at your contribution and may suggest:
The PR will be prioritized according to our internal development and testing capacity. We’ll let you know when it’s ready to move to the next step or if any changes are needed. |
…base into coylecullen-issue-2152-npe
After taking a look at this PR and the #2152 issue it was listed as fixing, I ended up rewriting this PR's description to be more stand-alone. The null pointer exception in 2152 was handled separately, but this still fixes a needed problem so this should explain it for the remaining portion better. I did find that I had to update the generated changelog xsd version to one that supports the columnDataType attribute, so that is in there there too. I also merged origin/master into your fork so it builds better now |
Description
In 4.6.2, changesets generated due to differences in column remarks would not include the columnDataType attribute which is needed for some databases (mysql for sure).
This change adds the datatype to the generated Change if it is available.
Repo Steps
If you create two tables on different databases with different comments like this:
then run
liquibase diff-changelog
between the intuser_db and intuser_db2 databases, the generated changeset used to look like this:without the columnDataType attribute. If you tried to run this changeset against a mysql database, it would fail with a "columnDataType is required" error.
With this change, the generated changest looks like this:
which cleanly applies to mysql and other database types.
Dev Handoff Notes (Internal Use)
Links
Testing
Dev Verification
Ensured the steps listed above work locally.
Test Requirements (Liquibase Internal QA)
You will require 2 MySQL database instances.
Setup
On first database instance execute
create table test_table (id int, int_col int COMMENT 'database 1', char_col char(50) COMMENT 'first test');
On second database instance execute
create table test_table (id int, int_col int COMMENT 'database 2', char_col char(50) COMMENT 'second test');
Manual Tests
Verify diff-changelog generates columnDataType parameter.
liquibase diff-changelog --changelog-file lb2199-changelog.xml
columnName="int_col" columnDataType="int(10)"
argumentscolumnName="char_col" columnDataType="char(50)"
argumentsVerify update is successful with generated changelog.
liquibase update --changelog-file lb2199-changelog.xml
database 2
remarksecond test
remarkRepeat all tests for json, yaml and sql changelog formats.
Automated Tests
No new functional tests required for this fix.
┆Issue is synchronized with this Jira Bug by Unito