Skip to content

Commit

Permalink
fixed String datatype
Browse files Browse the repository at this point in the history
  • Loading branch information
KushnirykOleh committed Aug 1, 2024
1 parent ccb630e commit 48ca145
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import liquibase.database.Database;
import liquibase.datatype.DataTypeInfo;
import liquibase.datatype.DatabaseDataType;
import liquibase.datatype.LiquibaseDataType;
import liquibase.datatype.core.VarcharType;
import liquibase.ext.databricks.database.DatabricksDatabase;
import liquibase.servicelocator.PrioritizedService;

Expand All @@ -13,9 +13,9 @@
minParameters = 0,
maxParameters = 0,
priority = PrioritizedService.PRIORITY_DATABASE,
aliases = { "varchar", "clob", "java.lang.String" }
aliases = {"clob", "java.lang.String" }
)
public class StringDatatypeDatabricks extends LiquibaseDataType {
public class StringDatatypeDatabricks extends VarcharType {
public StringDatatypeDatabricks() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
<changeSet id="1" author="codydavis">
<addColumn tableName="authors">
<column name="varcharColumn" type="STRING" value="INITIAL_VALUE"/>
<column name="stringColumn" type="STRING" value="INITIAL_VALUE"/>
<column name="varcharColumn" type="varchar(50)" value="INITIAL_VALUE"/>
<column name="intColumn" type="INTEGER" valueNumeric="5"/>
<column name="dateColumn" type="DATE" valueDate="2023-09-21"/>
</addColumn>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"snapshot": {
"objects": {
"liquibase.structure.core.Table": [
{
"table": {
"name": "authors"
}
}
],
"liquibase.structure.core.Column": [
{
"column": {
"name": "varcharColumn",
"type": {

"columnSize": "50.*",
"typeName": "VARCHAR"
}
}
},
{
"column": {
"name": "stringColumn",
"type": {
"columnSize": "255.*",
"typeName": "STRING"
}
}
},
{
"column": {
"name": "intColumn",
"type": {
"typeName": "INT"
}
}
},
{
"column": {
"name": "dateColumn"
}
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ALTER TABLE main.liquibase_harness_test_ds.authors ADD COLUMN varcharColumn STRING
ALTER TABLE main.liquibase_harness_test_ds.authors ADD COLUMN stringColumn STRING
ALTER TABLE main.liquibase_harness_test_ds.authors ADD COLUMN varcharColumn VARCHAR(50)
ALTER TABLE main.liquibase_harness_test_ds.authors ADD COLUMN intColumn INT
ALTER TABLE main.liquibase_harness_test_ds.authors ADD COLUMN dateColumn date
UPDATE main.liquibase_harness_test_ds.authors SET stringColumn = 'INITIAL_VALUE'
UPDATE main.liquibase_harness_test_ds.authors SET varcharColumn = 'INITIAL_VALUE'
UPDATE main.liquibase_harness_test_ds.authors SET intColumn = 5
UPDATE main.liquibase_harness_test_ds.authors SET dateColumn = '2023-09-21'

0 comments on commit 48ca145

Please sign in to comment.