Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reflection support for new data types #107

Merged
merged 2 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-databricks</artifactId>
<version>1.1.2-SNAPSHOT</version>
<version>1.1.3-SNAPSHOT</version>

<name>Liquibase Extension: Databricks support</name>
<description>Liquibase Extension for Databricks.</description>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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;

@DataTypeInfo(
name = "boolean",
minParameters = 0,
maxParameters = 0,
priority = DatabricksDatabase.PRIORITY_DATABASE
)
public class BooleanDatatypeDatabricks extends LiquibaseDataType {

public BooleanDatatypeDatabricks() {
}

public boolean supports(Database database) {
return database instanceof DatabricksDatabase;
}

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;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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;

@DataTypeInfo(
name = "double",
minParameters = 0,
maxParameters = 0,
priority = DatabricksDatabase.PRIORITY_DATABASE
)
public class DoubleDatatypeDatabricks extends LiquibaseDataType {

public DoubleDatatypeDatabricks() {
}

public boolean supports(Database database) {
return database instanceof DatabricksDatabase;
}

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;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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;


@DataTypeInfo(
name = "float",
minParameters = 0,
maxParameters = 0,
priority = DatabricksDatabase.PRIORITY_DATABASE
)
public class FloatDatatypeDatabricks extends LiquibaseDataType {
public FloatDatatypeDatabricks() {
}

public boolean supports(Database database) {
return database instanceof DatabricksDatabase;
}

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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@
import liquibase.datatype.LiquibaseDataType;
import liquibase.ext.databricks.database.DatabricksDatabase;

import static liquibase.ext.databricks.database.DatabricksDatabase.PRIORITY_DATABASE;


@DataTypeInfo(
name = "int",
minParameters = 0,
maxParameters = 0,
priority = PRIORITY_DATABASE
priority = DatabricksDatabase.PRIORITY_DATABASE
)
public class IntegerDatatypeDatabricks extends LiquibaseDataType {
public IntegerDatatypeDatabricks() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ liquibase.ext.databricks.datatype.DatetimeDatatypeDatabricks
liquibase.ext.databricks.datatype.BigintDatatypeDatabricks
liquibase.ext.databricks.datatype.StringDatatypeDatabricks
liquibase.ext.databricks.datatype.IntegerDatatypeDatabricks
liquibase.ext.databricks.datatype.BooleanDatatypeDatabricks
liquibase.ext.databricks.datatype.FloatDatatypeDatabricks
liquibase.ext.databricks.datatype.DoubleDatatypeDatabricks
Loading