liquibase / liquibase-databricks

Apache License 2.0
26 stars 7 forks source link

DAT-18148: refactorings + tests #175

Closed filipelautert closed 2 months ago

filipelautert commented 2 months ago

The following changeset will create auto increment/generated columns:

    <changeSet author="testuser" id="4">
        <createTable tableName="tableac" >
            <column name="longcolumn" type="long" autoIncrement="true" generationType="IDENTITY" />
            <column name="eventTime" type="timestamp"/>
            <column name="year" type="int" defaultValueComputed="GENERATED ALWAYS AS (YEAR(eventTime))"/>
            <column name="eventDate" type="date" defaultValueComputed="GENERATED ALWAYS AS (CAST(eventTime AS DATE))" />
            <column name="eventDescription" type="string">
                <constraints nullable="false" />
            </column>
            <column name="eventShortDescription" type="string" defaultValueComputed="GENERATED ALWAYS AS (SUBSTRING(eventDescription, 0, 1))" />
        </createTable>
    </changeSet>
    <changeSet id="5" author="filipe">
        <insert tableName="tableac">
            <column name="eventTime" value="2022-01-01 00:00:00"/>
            <column name="eventDescription" value="My first event"/>
        </insert>
    </changeSet>

Nothing was required on databricks side, please see companion PR in core: https://github.com/liquibase/liquibase/pull/6263

vitaliimak commented 2 months ago

@filipelautert If you add an empty expectedSnapshot JSON file then the test will pass after the core change. image

filipelautert commented 2 months ago

If you add an empty expectedSnapshot JSON file then the test will pass after the core change.

Thanks @vitaliimak , I just pushed an empty one.

sonarcloud[bot] commented 2 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud