Skip to content

Commit

Permalink
fix: addcolumn changes are not respecting Datatypes classes
Browse files Browse the repository at this point in the history
  • Loading branch information
filipelautert committed Apr 2, 2024
1 parent 257bc18 commit 8dbf990
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 8dbf990

Please sign in to comment.