layout | title | includeDaticalBox |
---|---|---|
default |
Liquibase |
true |
- Supports code branching and merging
- Supports multiple developers
- Supports multiple database types
- Supports XML, YAML, JSON and SQL formats
- Supports context-dependent logic
- Cluster-safe database upgrades
- Generate Database change documentation
- Generate Database "diffs"
- Run through your build process, embedded in your application or on demand
- Automatically generate SQL scripts for DBA code review
- Does not require a live database connection
<div class="span-8 last">
<div class='highlight' style="border-bottom: none; margin-bottom: 0; border-bottom-right-radius:0; border-bottom-left-radius:0">
<h2>Get Started</h2>
<ol>
<li><a href="download/index.html">Download Liquibase</a></li>
<li>Create new changelog file in <a href="documentation/xml_format.html">XML</a>, <a href="documentation/yaml_format.html">YAML</a>,
<a href="documentation/json_format.html">JSON</a> or <a href="documentation/sql_format.html">SQL</a>format
</li>
<li>Add <a href="documentation/changeset.html">changeset</a> to <a href="documentation/databasechangelog.html">changelog</a> file</li>
<li>Run <a href="documentation/command_line.html">liquibase update</a></li>
<li>Commit changelog file to source control</li>
<li>GOTO 3</li>
</ol>
<div style="margin-bottom: 15px">
<a href="quickstart.html" style="font-weight: bolder;">Quick Start Guide</a> | <a href="documentation/index.html" style="font-weight: bolder;">Full Documentation</a>
</div>
</div>
<div class="highlight" style="border-top-right-radius:0; border-top-left-radius:0; margin-top: 0; background: #e6e6e6">
<h2 style="margin-bottom: 10px">Read More</h2>
<div style="margin-bottom:5px">
<a href="/dba.html" style="font-weight: bolder;">DBA</a> |
<a href="/qa.html" style="font-weight: bolder;">QA</a> |
<a href="/developer.html" style="font-weight: bolder;">Developer</a> |
<a href="/release_manager.html" style="font-weight: bolder;">Release Manager</a>
</div>
</div>
</div>
<div class="span-17 last">
<h1>Refactor Your Database</h1>
- Simple commands like Create Table and Drop Column
- Complex commands like Add Lookup Table and Merge Columns
- Specify the exact SQL to run
- Plus the ability to Generate and manage rollback logic
- Open Source: Apache 2.0 License
- Extension support allows you to extend and override virtually every part of Liquibase
- Java APIs for executing and embedding
<preConditions>
<runningAs username="liquibase"/>
</preConditions>
<changeSet id="1" author="nvoxland">
<createTable tableName="person">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="firstname" type="varchar(50)"/>
<column name="lastname" type="varchar(50)">
<constraints nullable="false"/>
</column>
<column name="state" type="char(2)"/>
</createTable>
</changeSet>
<changeSet id="2" author="nvoxland">
<addColumn tableName="person">
<column name="username" type="varchar(8)"/>
</addColumn>
</changeSet>
<changeSet id="3" author="nvoxland">
<addLookupTable
existingTableName="person" existingColumnName="state"
newTableName="state" newColumnName="id" newColumnDataType="char(2)"/>
</changeSet>
{% endhighlight %}
-
changeSet: id: 1 author: nvoxland changes: - createTable: tableName: person columns: - column: name: id type: int autoIncrement: true constraints: primaryKey: true nullable: false - column: name: firstname type: varchar(50) - column: name: lastname type: varchar(50) constraints: nullable: false - column: name: state type: char(2)
-
changeSet: id: 2 author: nvoxland changes: - addColumn: tableName: person columns: - column: name: username type: varchar(8)
-
changeSet: id: 3 author: nvoxland changes: - addLookupTable: existingTableName: person existingColumnName:state newTableName: state newColumnName: id newColumnDataType: char(2)
{% endhighlight %}
{
"changeSet": {
"id": "1",
"author": "nvoxland",
"changes": [
{
"createTable": {
"tableName": "person",
"columns": [
{
"column": {
"name": "id",
"type": "int",
"autoIncrement": true,
"constraints": {
"primaryKey": true,
"nullable": false
},
}
},
{
"column": {
"name": "firstname",
"type": "varchar(50)"
}
},
{
"column": {
"name": "lastname",
"type": "varchar(50)"
"constraints": {
"nullable": false
},
}
},
{
"column": {
"name": "state",
"type": "char(2)"
}
}
]
}
}
]
}
},
{
"changeSet": {
"id": "2",
"author": "nvoxland",
"changes": [
{
"addColumn": {
"tableName": "person",
"columns": [
{
"column": {
"name": "username",
"type": "varchar(8)"
}
}
]
}
}
]
}
},
{
"changeSet": {
"id": "3",
"author": "nvoxland",
"changes": [
{
"addLookupTable": {
"tableName": "person",
"existingTableName": "person",
"existingColumnName":"state",
"newTableName": "state",
"newColumnName": "id",
"newColumnDataType": "char(2)",
}
}
]
}
}
]
}
{% endhighlight %}
--changeset nvoxland:1 create table person ( id int not null primary key, firstname varchar(80), lastname varchar(80) not null, state varchar(2) );
--changeset nvoxland:2 alter table person add column username varchar(8)
--changeset nvoxland:3 create table state AS SELECT DISTINCT state AS id FROM person WHERE state IS NOT NULL; alter table state modify id char(2) NOT NULL; alter table state add primary key(id); alter table person add constraint fk_person_state foreign key (state) references state(id);
{% endhighlight %}