Skip to content
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 for CORE-955 #5

Closed
wants to merge 1 commit into from
Closed

Fix for CORE-955 #5

wants to merge 1 commit into from

Conversation

dhsmith1001
Copy link
Contributor

Added liquibase.sqlgenerator.core.ModifyDataTypeGeneratorMySQL to fix CORE-955 "Supress "modifyDataType will lose primary key settings for mysql" warning if changelog says it is ok". ModifyDataTypeGeneratorMySQL uses a DatabaseSnapshot to determine what properties the column has, and add them to the alter statement so the correct properties are maintained, not lost.

liquibase.sqlgenerator.core.ModifyDataTypeGeneratorMySQL to maintin
column properties.
@nvoxland
Copy link
Contributor

I think we will run into a problem with your code under updateSQL mode since the column may not exist or may be different than the point it will be at when the generated SQL would be ran.

@dhsmith1001
Copy link
Contributor Author

Many changes have problems in updateSQL mode -- hence the option to ignore preConditions. This is another time when having an internal model of the database state would solve the problems inherent in updateSQL mode where the database state doesn't change during update processing.

I will add some code to abort processing if the column doesn't exist. Do you have any other suggestions to make it more robust? I don't want to abandon this change, as it's critical for the product I'm working on at the moment.

@dhsmith1001
Copy link
Contributor Author

I have looked further at this code, and I can return without adding extra clauses to the SQL if the column metadata is not contained in the database snapshot. However I'd like to emit the warning about losing column constraints if and only if the mode is updateSQL rather than update. I can't see a way to determine this from within the warn method of AbstractSQLGenerator interface. Do you know of a way?

@nvoxland
Copy link
Contributor

nvoxland commented Sep 8, 2011

You could move the warning to requiresUpdatedDatabaseMetadata and still return false, that method is only called when doing an updateSQL. It's not the most obvious code, however. Perhaps we need a new databaseMetadataUpToDate field added to AbstractSQLGenerator

nvoxland added a commit that referenced this pull request Jan 22, 2018
ZOS-80 When diffChangeLog detects one of the change types that requir…
mm65de added a commit to mm65de/liquibase that referenced this pull request Mar 10, 2023
filipelautert pushed a commit that referenced this pull request Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants