This repository has been archived by the owner on Jul 2, 2022. It is now read-only.
forked from bruce-szalwinski/liquibase-snowflake
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added customDatatype for correct text mapping (#51)
- Loading branch information
1 parent
1a13bff
commit dfc41f3
Showing
4 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
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
30 changes: 30 additions & 0 deletions
30
src/main/java/liquibase/ext/snowflake/datatype/SnowflakeTextDataType.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,30 @@ | ||
package liquibase.ext.snowflake.datatype; | ||
|
||
import liquibase.change.core.LoadDataChange; | ||
import liquibase.database.Database; | ||
import liquibase.datatype.DataTypeInfo; | ||
import liquibase.datatype.DatabaseDataType; | ||
import liquibase.datatype.LiquibaseDataType; | ||
import liquibase.ext.snowflake.database.SnowflakeDatabase; | ||
|
||
@DataTypeInfo(name = "text", minParameters = 0, maxParameters = 0, priority = LiquibaseDataType.PRIORITY_DATABASE) | ||
public class SnowflakeTextDataType extends LiquibaseDataType { | ||
|
||
@Override | ||
public boolean supports(Database database) { | ||
return database instanceof SnowflakeDatabase; | ||
} | ||
|
||
@Override | ||
public DatabaseDataType toDatabaseDataType(Database database) { | ||
if (database instanceof SnowflakeDatabase) { | ||
return new DatabaseDataType("TEXT", getParameters()); | ||
} | ||
return super.toDatabaseDataType(database); | ||
} | ||
|
||
@Override | ||
public LoadDataChange.LOAD_DATA_TYPE getLoadTypeName() { | ||
return LoadDataChange.LOAD_DATA_TYPE.STRING; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
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 +1,2 @@ | ||
liquibase.ext.snowflake.datatype.TimestampNTZType | ||
liquibase.ext.snowflake.datatype.SnowflakeTextDataType |
1 change: 1 addition & 0 deletions
1
...test/resources/liquibase/harness/change/expectedSql/snowflake/createTableDataTypeText.sql
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 @@ | ||
CREATE TABLE createTableDataTypeText (textCol TEXT) |