Search code examples
postgresqlmigrationliquibasebigint

Liquibase creates column as BIGINT in Postgres even though "INT" is specified in config


I have the following liquibase script snippet:

<changeSet author="h311z" id="20220406-1" runInTransaction="false">
        <createTable tableName="states">
            <column name="tx_id" type="varbinary(1024)">
                <constraints nullable="false"/>
            </column>
            <column name="tx_output_id" type="INT">
                <constraints nullable="false"/>
            </column>
        </createTable>
    </changeSet>

But after running liquibase migration on a Postgres database, the table looks like this:

       column_name        | data_type 
--------------------------+-----------
 tx_id              | bytea
 tx_output_id       | bigint

Am I missing something here? Thanks!


Solution

  • Turns out the underlying database was CockroachDB which does not differentiate INT/BIGINT, they are basically the same: https://www.cockroachlabs.com/docs/v20.1/int

    I ended up using tinyint instead.