diff --git a/src/main/java/liquibase/ext/databricks/datatype/ArrayDatatypeDatabricks.java b/src/main/java/liquibase/ext/databricks/datatype/ArrayDatatypeDatabricks.java new file mode 100644 index 00000000..d42117c1 --- /dev/null +++ b/src/main/java/liquibase/ext/databricks/datatype/ArrayDatatypeDatabricks.java @@ -0,0 +1,44 @@ +package liquibase.ext.databricks.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.databricks.database.DatabricksDatabase; +import liquibase.servicelocator.PrioritizedService; + +@DataTypeInfo( + name = "array", + minParameters = 0, + maxParameters = 0, + priority = PrioritizedService.PRIORITY_DATABASE +) +public class ArrayDatatypeDatabricks extends LiquibaseDataType { + + public ArrayDatatypeDatabricks() { + // empty constructor + } + + @Override + public boolean supports(Database database) { + return database instanceof DatabricksDatabase; + } + + @Override + public DatabaseDataType toDatabaseDataType(Database database) { + if (database instanceof DatabricksDatabase) { + + DatabaseDataType type = new DatabaseDataType("ARRAY", this.getParameters()); + type.setType("ARRAY"); + return type; + } else { + return super.toDatabaseDataType(database); + } + + } + + public LoadDataChange.LOAD_DATA_TYPE getLoadTypeName() { + return LoadDataChange.LOAD_DATA_TYPE.STRING; + } +} \ No newline at end of file diff --git a/src/main/resources/META-INF/services/liquibase.datatype.LiquibaseDataType b/src/main/resources/META-INF/services/liquibase.datatype.LiquibaseDataType index 88a93c6e..7956a1df 100644 --- a/src/main/resources/META-INF/services/liquibase.datatype.LiquibaseDataType +++ b/src/main/resources/META-INF/services/liquibase.datatype.LiquibaseDataType @@ -5,3 +5,4 @@ liquibase.ext.databricks.datatype.IntegerDatatypeDatabricks liquibase.ext.databricks.datatype.BooleanDatatypeDatabricks liquibase.ext.databricks.datatype.FloatDatatypeDatabricks liquibase.ext.databricks.datatype.DoubleDatatypeDatabricks +liquibase.ext.databricks.datatype.ArrayDatatypeDatabricks