generated from liquibase/liquibase-extension-example
-
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.
adds a fix to type array to databricks, array types used to carry the…
…ir size column causing problems when you want to update changeset on databricks, this fix remove fix column same as boolean type
- Loading branch information
Paulo Dias
committed
Mar 8, 2024
1 parent
69a16ce
commit 7d40cb9
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
src/main/java/liquibase/ext/databricks/datatype/ArrayDatatypeDatabricks.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,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<string>", | ||
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<STRING>", this.getParameters()); | ||
type.setType("ARRAY<STRING>"); | ||
return type; | ||
} else { | ||
return super.toDatabaseDataType(database); | ||
} | ||
|
||
} | ||
|
||
public LoadDataChange.LOAD_DATA_TYPE getLoadTypeName() { | ||
return LoadDataChange.LOAD_DATA_TYPE.STRING; | ||
} | ||
} |
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