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.
Add reflection support for new data types (#107)
* Add reflection support for new data types Add snapshot reflection support for the following databricks data types: -- Float -- Double -- Bool * chore(sonar): fix sonar warnings --------- Co-authored-by: filipe <[email protected]>
- Loading branch information
1 parent
855da70
commit 150757d
Showing
6 changed files
with
141 additions
and
4 deletions.
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
44 changes: 44 additions & 0 deletions
44
src/main/java/liquibase/ext/databricks/datatype/BooleanDatatypeDatabricks.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 = "boolean", | ||
minParameters = 0, | ||
maxParameters = 0, | ||
priority = PrioritizedService.PRIORITY_DATABASE | ||
) | ||
public class BooleanDatatypeDatabricks extends LiquibaseDataType { | ||
|
||
public BooleanDatatypeDatabricks() { | ||
// 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("BOOLEAN", this.getParameters()); | ||
type.setType("BOOLEAN"); | ||
return type; | ||
} else { | ||
return super.toDatabaseDataType(database); | ||
} | ||
|
||
} | ||
|
||
public LoadDataChange.LOAD_DATA_TYPE getLoadTypeName() { | ||
return LoadDataChange.LOAD_DATA_TYPE.BOOLEAN; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/main/java/liquibase/ext/databricks/datatype/DoubleDatatypeDatabricks.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 = "double", | ||
minParameters = 0, | ||
maxParameters = 0, | ||
priority = PrioritizedService.PRIORITY_DATABASE | ||
) | ||
public class DoubleDatatypeDatabricks extends LiquibaseDataType { | ||
|
||
public DoubleDatatypeDatabricks() { | ||
// 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("DOUBLE", this.getParameters()); | ||
type.setType("DOUBLE"); | ||
return type; | ||
} else { | ||
return super.toDatabaseDataType(database); | ||
} | ||
|
||
} | ||
|
||
public LoadDataChange.LOAD_DATA_TYPE getLoadTypeName() { | ||
return LoadDataChange.LOAD_DATA_TYPE.NUMERIC; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/main/java/liquibase/ext/databricks/datatype/FloatDatatypeDatabricks.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 = "float", | ||
minParameters = 0, | ||
maxParameters = 0, | ||
priority = PrioritizedService.PRIORITY_DATABASE | ||
) | ||
public class FloatDatatypeDatabricks extends LiquibaseDataType { | ||
public FloatDatatypeDatabricks() { | ||
// 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("FLOAT", this.getParameters()); | ||
type.setType("FLOAT"); | ||
return type; | ||
} else { | ||
return super.toDatabaseDataType(database); | ||
} | ||
|
||
} | ||
|
||
public LoadDataChange.LOAD_DATA_TYPE getLoadTypeName() { | ||
return LoadDataChange.LOAD_DATA_TYPE.NUMERIC; | ||
} | ||
} |
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
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