LiquiBase Database Change Management http://www.liquibase.org March 30 th , 2009 Mike Willbanks Sr. Software Engineer, Car...
What is LiquiBase <ul><li>LiquiBase is an open source, database-independent library for tracking, managing and applying da...
Why LiquiBase? <ul><li>Consistent database changes. </li></ul><ul><li>Manage databases at different states. </li></ul><ul>...
Problems of Manual Changes <ul><li>Inconsistent application of changes. </li></ul><ul><li>Ineffective mechanisms for manag...
The ChangeLog <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> </li></ul><ul><li><databaseChangeLog xmln...
Generating a ChangeLog <ul><li>Getting started, you may want to generate a list of your current database. </li></ul><ul><l...
Running a ChangeLog <ul><li>Running a changelog is easy, we will focus on the command line client. </li></ul><ul><li>When ...
LiquiBase Functionality <ul><li>LiquiBase refactoring functionality: </li></ul><ul><ul><li>Structural </li></ul></ul><ul><...
An Example <ul><li>We have a database &quot;meetup&quot;, we want to have two tables: </li></ul><ul><ul><li>meetup: contai...
Why LiquiBase over Alternatives <ul><li>XML file makes it easier to read changes and see a history of changes. </li></ul><...
Questions?
Upcoming SlideShare
Loading in...5
×

LiquiBase

6,256

Published on

LiquiBase is an open source database change management system.

Published in: Technology
0 Comments
8 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
6,256
On Slideshare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
159
Comments
0
Likes
8
Embeds 0
No embeds

No notes for slide

Transcript of "LiquiBase"

  1. 1. LiquiBase Database Change Management http://www.liquibase.org March 30 th , 2009 Mike Willbanks Sr. Software Engineer, CaringBridge Inc.
  2. 2. What is LiquiBase <ul><li>LiquiBase is an open source, database-independent library for tracking, managing and applying database changes. </li></ul><ul><li>Database changes are stored in an XML file and (optionally) checked into source control. </li></ul><ul><li>LiquiBase executes changes based on this XML file to handle different revisions of database structures and data. </li></ul>
  3. 3. Why LiquiBase? <ul><li>Consistent database changes. </li></ul><ul><li>Manage databases at different states. </li></ul><ul><li>Keep a history of changes. </li></ul><ul><li>Automatic rollback support. </li></ul><ul><li>Ability of automation. </li></ul><ul><li>Effectively manage variable change. </li></ul><ul><li>Less human resources / errors. </li></ul>
  4. 4. Problems of Manual Changes <ul><li>Inconsistent application of changes. </li></ul><ul><li>Ineffective mechanisms for managing changes. </li></ul><ul><li>Database changes may or may not have been communicated to the team. </li></ul><ul><li>Databases may become out of sync between environments. </li></ul>
  5. 5. The ChangeLog <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> </li></ul><ul><li><databaseChangeLog xmlns=&quot;http://www.liquibase.org/xml/ns/dbchangelog/1.9&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation=&quot;http://www.liquibase.org/xml/ns/dbchangelog/1.9 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd&quot;> <changeSet id=&quot;1&quot; author=&quot;mike&quot;> </li></ul><ul><li><createTable tableName=&quot;userGroup&quot;> </li></ul><ul><li><column name=&quot;id&quot; type=&quot;int&quot; autoIncrement=&quot;true&quot;> </li></ul><ul><li><constraints primaryKey=&quot;true&quot; nullable=&quot;false&quot; /> </li></ul><ul><li></column> </li></ul><ul><li><column name=&quot;name&quot; type=&quot;varchar(100)&quot; /> </li></ul><ul><li></createTable> </li></ul><ul><li></changeSet> </li></ul><ul><li></databaseChangeLog> </li></ul><ul><li>The changelog is an xml file where all database changes are listed. </li></ul><ul><li>The changelog contains a changeset that lists each individual change. </li></ul><ul><li>The above is an example of creating a table and adding columns. </li></ul>
  6. 6. Generating a ChangeLog <ul><li>Getting started, you may want to generate a list of your current database. </li></ul><ul><li>LiquiBase makes this easy by allowing you to run a simple command from the command line client to generate a full changelog. </li></ul><ul><li>Limitations do exist such that it will not export triggers, stored procedures, functions and packages. </li></ul><ul><li>liquibase --driver=com.mysql.jdbc.Driver --classpath=/path/to/classes --changeLogFile=/path/to/db.changelog.xml --url=&quot;jdbc:mysql://hostname/database&quot; --username=dbusername --password=dbpassword generateChangeLog </li></ul>
  7. 7. Running a ChangeLog <ul><li>Running a changelog is easy, we will focus on the command line client. </li></ul><ul><li>When you first run a changelog, LiquiBase manages those changelogs by adding two tables into your database. </li></ul><ul><ul><li>databasechangelog: maintains the database changes that were run. </li></ul></ul><ul><ul><li>databasechangeloglock: ensures that two machines don't attempt to modify the database at one time. </li></ul></ul><ul><li>liquibase --driver=com.mysql.jdbc.Driver --classpath=/path/to/classes --changeLogFile=/path/to/db.changelog.xml --url=&quot;jdbc:mysql://hostname/database&quot; --username=dbusername --password=dbpassword migrate </li></ul>
  8. 8. LiquiBase Functionality <ul><li>LiquiBase refactoring functionality: </li></ul><ul><ul><li>Structural </li></ul></ul><ul><ul><ul><li>Columns, Tables, Views, Stored Procedures </li></ul></ul></ul><ul><ul><li>Data Quality </li></ul></ul><ul><ul><ul><li>Lookup Tables, Constraints, Sequences, Defaults. </li></ul></ul></ul><ul><ul><li>Referential Integrity </li></ul></ul><ul><ul><ul><li>Foreign Keys, Primary Keys </li></ul></ul></ul><ul><ul><li>Transformations </li></ul></ul><ul><ul><ul><li>Insert, Update, Delete, Tag, Stop </li></ul></ul></ul><ul><ul><li>Architectual </li></ul></ul><ul><ul><ul><li>Indexes </li></ul></ul></ul><ul><ul><li>Custom </li></ul></ul><ul><ul><ul><li>Custom SQL, Modify SQL, Execution </li></ul></ul></ul>
  9. 9. An Example <ul><li>We have a database &quot;meetup&quot;, we want to have two tables: </li></ul><ul><ul><li>meetup: contains an id, name, description and the date it was created and last updated. </li></ul></ul><ul><ul><li>event: contains an id, a meetup id, event name, event description and event date. </li></ul></ul>
  10. 10. Why LiquiBase over Alternatives <ul><li>XML file makes it easier to read changes and see a history of changes. </li></ul><ul><li>Support for multiple ChangeLogs </li></ul><ul><ul><li>Example: Pre-Deployment, Post-Deployment. </li></ul></ul><ul><li>Run through automated systems. </li></ul><ul><li>Heavily documented. </li></ul><ul><li>Project activity. </li></ul>
  11. 11. Questions?
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×