0

要为表更改生成数据库更改日志,我使用 Liquibase。但是 liquibase 更改日志不包含列名的特定位置。

以下更改集是通过 liquibase 生成的

<changeSet author="Nevil" id="234324324324">
    <addColumn tableName="request">
        <column name="revenue" type="DECIMAL(10,2)">
            <constraints nullable="false"/>
        </column>
    </addColumn>
</changeSet>

假设如果我希望列在表中的revenue列之后,liquibase 不会记下 alter table 推荐中的 AFTER 子句。实际上,我不能用 liquibase 做到这一点。有解决的朋友吗?idrequest

4

1 回答 1

1

I was told that one cannot rely on column order when processing the following query:

SELECT * FROM my_table;

One should always specify the columns required:

SELECT col1, col2, col3 FROM my_table;

Following this advice makes the column order within the table a cosmetic concern.

I'm completely open to correction, but I don't think all databases support adding columns mid-table.

于 2012-01-08T22:49:09.817 回答