LiquiBase
Upcoming SlideShare
Loading in...5
×
 

LiquiBase

on

  • 7,784 views

LiquiBase is an open source database change management system.

LiquiBase is an open source database change management system.

Statistics

Views

Total Views
7,784
Views on SlideShare
7,378
Embed Views
406

Actions

Likes
7
Downloads
133
Comments
0

15 Embeds 406

http://blog.digitalstruct.com 317
http://www.planet-php.net 39
http://www.slideshare.net 19
http://www.linkedin.com 9
http://planet-php.org 5
http://www.planet-php.org 4
https://www.linkedin.com 2
http://headlines.bistoure.com 2
http://phpeye.com 2
http://www.phpeye.com 2
http://intranet.ukntech.com 1
http://www.slashdocs.com 1
https://duckduckgo.com 1
http://rss.mmckeon.com 1
http://huhry.dyndns-web.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

LiquiBase LiquiBase Presentation Transcript

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