Skip to content

Commit

Permalink
#3035 add Double data type class to avoid incorrect double(0) databas…
Browse files Browse the repository at this point in the history
…e data type result
  • Loading branch information
LonwoLonwo committed Jan 17, 2023
1 parent 705547f commit b76315f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package liquibase.datatype.core;

import liquibase.database.Database;
import liquibase.database.core.SnowflakeDatabase;
import liquibase.datatype.DataTypeInfo;
import liquibase.datatype.DatabaseDataType;
import liquibase.datatype.LiquibaseDataType;

@DataTypeInfo(
name = "double",
aliases = {"java.sql.Types.DOUBLE", "java.lang.Double"},
minParameters = 0,
maxParameters = 2,
priority = LiquibaseDataType.PRIORITY_DATABASE
)
public class DoubleDataTypeSnowflake extends DoubleType {

public DoubleDataTypeSnowflake() {

}

public int getPriority() {
return LiquibaseDataType.PRIORITY_DATABASE;
}

@Override
public boolean supports(Database database) {
return database instanceof SnowflakeDatabase;
}

@Override
public DatabaseDataType toDatabaseDataType(Database database) {
// Double is an alias for the FLOAT data type in Snowflake.
return new DatabaseDataType("FLOAT");
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
liquibase.datatype.core.TextDataTypeSnowflake
liquibase.datatype.core.TimestampNTZTypeSnowflake
liquibase.datatype.core.TimestampNTZTypeSnowflake
liquibase.datatype.core.DoubleDataTypeSnowflake

0 comments on commit b76315f

Please sign in to comment.