liquibase tutorial code example

Example 1: liquibase

<changeSet context="legacy" author="author (generated)" id="1">
    <createTable tableName="test">
        <column autoIncrement="true" name="id" type="SERIAL">
            <constraints primaryKey="true" primaryKeyName="test_pkey"/>
        </column>
        <column name="c1" type="VARCHAR(255)"/>
        <column name="c2" type="INTEGER"/>
        <column name="c3" type="SMALLINT"/>
        <column name="c4" type="VARCHAR(255)"/>
        <column name="c5" type="TEXT"/>
        <column name="c6" type="VARCHAR(255)"/>
    </createTable>
</changeSet>

Example 2: liquibase

<databasechangelog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
  <changeset id="1" author="[email protected]" runonchange="true"> 
    <createtable tablename="Person"> 
      <column autoincrement="true" name="id" type="BIGINT"> 
        <constraints nullable="false" primarykey="true"> 
        </constraints>
      </column> 
      <column name="name" type="VARCHAR(255)"> 
        <constraints nullable="false"> 
        </constraints>
      </column> 
    </createtable> 
  </changeset>
</databasechangelog>

Tags:

Misc Example