From 8dbf990c8d2aeb9f76d4f7c1347722b52a0a8198 Mon Sep 17 00:00:00 2001 From: filipe Date: Wed, 13 Mar 2024 16:40:34 -0300 Subject: [PATCH] fix: addcolumn changes are not respecting Datatypes classes --- .../changelog/core/MissingColumnChangeGenerator.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/liquibase-standard/src/main/java/liquibase/diff/output/changelog/core/MissingColumnChangeGenerator.java b/liquibase-standard/src/main/java/liquibase/diff/output/changelog/core/MissingColumnChangeGenerator.java index 5cd26dcd7cd..7c329960034 100644 --- a/liquibase-standard/src/main/java/liquibase/diff/output/changelog/core/MissingColumnChangeGenerator.java +++ b/liquibase-standard/src/main/java/liquibase/diff/output/changelog/core/MissingColumnChangeGenerator.java @@ -5,6 +5,9 @@ import liquibase.change.ConstraintsConfig; import liquibase.change.core.AddColumnChange; import liquibase.database.Database; +import liquibase.datatype.DataTypeFactory; +import liquibase.datatype.DatabaseDataType; +import liquibase.datatype.LiquibaseDataType; import liquibase.diff.output.DiffOutputControl; import liquibase.diff.output.changelog.AbstractChangeGenerator; import liquibase.diff.output.changelog.ChangeGeneratorChain; @@ -63,9 +66,10 @@ public Change[] fixMissing(DatabaseObject missingObject, DiffOutputControl contr AddColumnConfig columnConfig = createAddColumnConfig(); columnConfig.setName(column.getName()); - String dataType = column.getType().toString(); - - columnConfig.setType(dataType); + LiquibaseDataType ldt = DataTypeFactory.getInstance().from(column.getType(), referenceDatabase); + DatabaseDataType ddt = ldt.toDatabaseDataType(comparisonDatabase); + String typeString = ddt.toString(); + columnConfig.setType(typeString); MissingTableChangeGenerator.setDefaultValue(columnConfig, column, comparisonDatabase);