Q:

Liquibase: Copy column data into a new column in the same table

I have a table with a column A. I am creating a new column B. B will have the same data as column A. How do I replicate the column in Liquibase? Is there some expression I can write to do the replication?

A:

Create a new changeset where you add a new column, and then update column B using the <sql> tag:
<changeSet author="yourName" id="example">
    <addColumn catalogName="db"
               schemaName="public"
               tableName="yourTable">
        <!-- replace varchar(255) with the actual type of column A -->
        <column name="B" type="varchar(255)"/>
    </addColumn>

    <sql>UPDATE yourTable SET B = A</sql>
</changeSet>

