GithubHelp home page GithubHelp logo

abellina / liqui-cap-online Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mbenshoof/liqui-cap-online

0.0 3.0 0.0 10.68 MB

Sample integration between Liquibase, Capistrano, and pt-online-schema-change

CSS 0.02% Shell 0.03% Java 92.73% XSLT 0.10% Perl 7.11%

liqui-cap-online's Introduction

liqui-cap-online

Sample integration between Liquibase, Capistrano, and pt-online-schema-change

Purpose

This is a proof of concept that was simply meant to show the functionality. Essentailly, this project handles the following:

  • Capturing the output of Liquibase rather than running it directly
  • Parsing each statement to determine the type
  • Converting CREATE INDEX statements to ALTER TABLE statements
  • Switching ALTER statements to use pt-online-schema-change

The goal is to allow non-blocking deployments of database changes within a larger deployment (i.e. Capistrano) environment.

Requirements

This system was built on the following test environemnt:

  • Centos 6.4
  • Percona Server 5.5 website
  • Capistrano (2.9.0) website
    • Requires Ruby (1.8.7), Rubygem (2.1.10)
  • Liquibase (2.0.5) website
    • Requires java (1.5, not JDK) and Java MySQL connector (included)
  • pt-online-schema-change (2.2.5) website

Note this was a local test VM and versions were just supplied by default yum installs

Naturally, setting these up is outside the scope of this README, but one thing I will note - when setting up using standard "yum" commands, you will need to specify the version of Capistrano as the current version doesn't work with the default Ruby/Rubygem install:

yum install ruby
yum install gcc g++ make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel
yum install ruby-rdoc ruby-devel
yum install rubygems
gem update --system
gem install capistrano -v 2.9.0

Samples

As part of this repo, I've included some sample changelog files that display different ALTER operations.

To use, simply create a new, empty database (mydb in this case) and then run the capfile run_liquibase_alters task 3 times, each time changing the real changelog file the master file points to:

<include file="samples/changelog_01.xml" relativeToChangelogFile="true"/>

Once you've applied the 3 changelog files, you can run the clean_old_tables task to drop the old tables left by pt-osc. Note - these tables are left by adding the --no-drop-table flag to pt-osc to help with rollbacks

The samples directory also contains the mysqldump output of the test schema after applying the chnages and also one showing the cleanup.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.