forked from liquibase/liquibase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
liquibase#3035 add Double data type class to avoid incorrect double(0…
…) database data type result
- Loading branch information
1 parent
705547f
commit b76315f
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
liquibase-snowflake/src/main/java/liquibase/datatype/core/DoubleDataTypeSnowflake.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
...ibase-snowflake/src/main/resources/META-INF/services/liquibase.datatype.LiquibaseDataType
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |