grails-database-migration
grails-database-migration copied to clipboard
createTable/column is not behaving the same as addColumn
When there a table creation written by the plugin createTable/column :
java.lang.Integer = type: "INT"
org.joda.time.LocalDateTime = type: "timestamp" (my dialect is not taken into account, it should be timestamptz)
When there is a column added written by the plugin addColumn :
java.lang.Integer = type: "int4"
org.joda.time.LocalDateTime = type: "timestamptz"
The schema is not consistent.
@bassmartin Can you provide a sample project?
@Schlogen see https://github.com/bassmartin/sample_grails_dbm
Essentially the issue is here: https://github.com/liquibase/liquibase/blob/91a4e47bfe278e2ac17d1a8cca932554547fc5e7/liquibase-core/src/main/java/liquibase/datatype/core/DateTimeType.java#L144
The database is GormDatabase so it doesn't match any that are checked. The originalDefinition is timestamptz and the getName() resolves to timestamp.
The root of this is how columns are handled when a column is missing vs when a table is missing:
How columns are handled when a table is missing: https://github.com/liquibase/liquibase/blob/0c2c0fea18abeda20ab9b9921b11bb3dfaad7d71/liquibase-core/src/main/java/liquibase/diff/output/changelog/core/MissingTableChangeGenerator.java#L70
How columns are handled when a column is missing: https://github.com/liquibase/liquibase/blob/0c2c0fea18abeda20ab9b9921b11bb3dfaad7d71/liquibase-core/src/main/java/liquibase/diff/output/changelog/core/MissingColumnChangeGenerator.java#L70
The MissingColumnChangeGenerator should use the same logic as MissingTableChangeGenerator
@nvoxland Is there an issue for this in your system anywhere?