diff --git a/src/main/java/liquibase/ext/databricks/snapshot/jvm/ColumnSnapshotGeneratorDatabricks.java b/src/main/java/liquibase/ext/databricks/snapshot/jvm/ColumnSnapshotGeneratorDatabricks.java index 91f446bd..fe9a6eef 100644 --- a/src/main/java/liquibase/ext/databricks/snapshot/jvm/ColumnSnapshotGeneratorDatabricks.java +++ b/src/main/java/liquibase/ext/databricks/snapshot/jvm/ColumnSnapshotGeneratorDatabricks.java @@ -76,7 +76,6 @@ protected DatabaseObject snapshotObject(DatabaseObject example, DatabaseSnapshot if (functionMatcher.find()) { DatabaseFunction function = new DatabaseFunction(defaultValue); column.setDefaultValue(function); - column.setComputed(true); } else { column.setDefaultValue(defaultValue); } diff --git a/src/test/java/liquibase/ext/databricks/snapshot/jvm/ColumnSnapshotGeneratorDatabricksTest.java b/src/test/java/liquibase/ext/databricks/snapshot/jvm/ColumnSnapshotGeneratorDatabricksTest.java index f019af6d..72d36f4b 100644 --- a/src/test/java/liquibase/ext/databricks/snapshot/jvm/ColumnSnapshotGeneratorDatabricksTest.java +++ b/src/test/java/liquibase/ext/databricks/snapshot/jvm/ColumnSnapshotGeneratorDatabricksTest.java @@ -1,8 +1,6 @@ package liquibase.ext.databricks.snapshot.jvm; -import liquibase.database.jvm.JdbcConnection; import liquibase.exception.DatabaseException; -import liquibase.ext.databricks.database.DatabricksDatabase; import liquibase.snapshot.JdbcDatabaseSnapshot; import liquibase.statement.DatabaseFunction; import liquibase.structure.DatabaseObject; @@ -17,10 +15,6 @@ import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; import java.util.HashMap; import java.util.Map; @@ -46,7 +40,7 @@ class ColumnSnapshotGeneratorDatabricksTest { put("eventDescription", "default string, regular ? almost();!$#@^%[] String bigint"); put("eventShortDescription", "short desc"); }}; - private static final Map COLUMN_WITH_DEFAULT_COMPUTED_NAMES = new HashMap() {{ + private static final Map COLUMNS_WITH_DEFAULT_COMPUTED = new HashMap() {{ put("eventTime", new DatabaseFunction("current_timestamp()")); put("year", new DatabaseFunction("YEAR(CURRENT_TIMESTAMP())")); put("eventDate", new DatabaseFunction("CAST(CURRENT_TIMESTAMP() AS DATE)")); @@ -67,7 +61,7 @@ class ColumnSnapshotGeneratorDatabricksTest { @BeforeEach - public void setUp() throws DatabaseException, SQLException { + public void setUp() { snapshotGenerator = new ColumnSnapshotGeneratorDatabricks(); testedColumn = new Column(); testedColumn.setAttribute("relation", new Table(TEST_CATALOG_NAME, TEST_SCHEMA_NAME, TEST_TABLE_NAME)); @@ -75,7 +69,7 @@ public void setUp() throws DatabaseException, SQLException { } @Test - void snapshotObjectTest() throws DatabaseException, SQLException { + void snapshotObjectTest() throws DatabaseException { for(Map.Entry columnWithDefault : COLUMN_WITH_DEFAULT_NAMES.entrySet()) { testedColumn.setName(columnWithDefault.getKey()); testedColumn.setAttribute("liquibase-complete", true); @@ -85,12 +79,12 @@ void snapshotObjectTest() throws DatabaseException, SQLException { assertNotNull(((Column) databaseObject).getDefaultValue()); assertEquals(columnWithDefault.getValue(), ((Column) databaseObject).getDefaultValue()); } - for(Map.Entry columnWithDefaultComputed: COLUMN_WITH_DEFAULT_COMPUTED_NAMES.entrySet()) { + for(Map.Entry columnWithDefaultComputed: COLUMNS_WITH_DEFAULT_COMPUTED.entrySet()) { testedColumn.setName(columnWithDefaultComputed.getKey()); testedColumn.setAttribute("liquibase-complete", true); DatabaseObject databaseObject = snapshotGenerator.snapshotObject(testedColumn, snapshot); assertTrue(databaseObject instanceof Column); - assertTrue(((Column) databaseObject).getComputed()); + assertNull(((Column) databaseObject).getComputed()); assertNotNull(((Column) databaseObject).getDefaultValue()); assertEquals(columnWithDefaultComputed.getValue(), ((Column) databaseObject).getDefaultValue()); }