Sqitch

Sane database change management

View project onGitHub

Sqitch is a database change management application. What makes it different from your typical migration-style approaches? A few things:

No opinions

Sqitch is not integrated with any framework, ORM, or platform. Rather, it is a standalone change management system with no opinions about your database engine, application framework, or development environment.

Native scripting

Changes are implemented as scripts native to your selected database engine. Writing a PostgreSQL application? Write SQL scripts for psql. Writing a MySQL-backed app? Write SQL scripts for mysql.

Dependency resolution

Database changes may declare dependencies on other changes--even on changes from other Sqitch projects. This ensures proper order of execution, even when you’ve committed changes to your VCS out-of-order.

No numbering

Change deployment is managed by maintaining a plan file. As such, there is no need to number your changes, although you can if you want. Sqitch doesn’t much care how you name your changes.

Iterative development

Up until you tag and release your application, you can modify your change deployment scripts as often as you like. They’re not locked in just because they’ve been committed to your VCS. This allows you to take an iterative approach to developing your database schema. Or, better, you can do test-driven database development.

Installation

There are a number of ways to install Sqitch. The PostgreSQL support requires PostgreSQL; the Oracle support requires Instant Client (and the setting of the $ORACLE_HOME environment variable).

CPAN

  • PostgreSQL: cpan App::Sqitch DBD::Pg
  • SQLite: cpan App::Sqitch DBD::SQLite
  • Oracle: cpan App::Sqitch DBD::Oracle
  • MySQL: cpan App::Sqitch DBD::mysql
  • Firebird: cpan App::Sqitch DBD::Firebird
  • Vertica: cpan App::Sqitch DBD::ODBC

Homebrew

  • Tap: brew tap theory/sqitch
  • PostreSQL: brew install sqitch_pg
  • SQLite: brew install sqitch_sqlite
  • Oracle: brew install sqitch_oracle
  • MySQL: brew install sqitch_mysql
  • Firebird: brew install sqitch_firebird
  • Vertica: brew install sqitch_vertica

Debian sid (unstable, testing)

  • Apt: apt-get install sqitch
  • PostreSQL: apt-get install libdbd-pg-perl postgresql-client
  • SQLite: apt-get install libdbd-sqlite3-perl sqlite3
  • Oracle: apt-get install libdbd-oracle-perl
  • MySQL: apt-get install libdbd-mysql-perl mysql-client
  • Firebird Classic: apt-get install libdbd-firebird-perl firebird2.5-classic
  • Firebird Super: apt-get install libdbd-firebird-perl firebird2.5-super
  • Vertica: apt-get install libdbd-odbc-perl

ActiveState PPM

  • Install ActivePerl
  • Run ppm install App-Sqitch
  • For Oracle support, also run ppm install DBD-Oracle
  • For Firebird support, also run ppm install DBD-Firebird

Apt + cpanminus

  • Apt: apt-get install build-essential cpanminus perl perl-doc
  • Sqitch: cpanm --quiet --notest App::Sqitch
  • PostreSQL: apt-get install postgresql libdbd-pg-perl
  • SQLite: apt-get install sqlite libdbd-sqlite3-perl
  • Oracle: apt-get install libdbd-oracle-perl
  • MySQL: apt-get install mysql libdbd-mysql-perl
  • Firebird: apt-get install firebird libdbd-firebird-perl
  • Vertica: apt-get install libdbd-odbc-perl

Yum + cpanminus

  • Yum: sudo yum install perl-devel perl-CPAN \
    && curl -L http://cpanmin.us | perl - --sudo App::cpanminus
  • Sqitch: cpanm --quiet --notest App::Sqitch
  • PostreSQL: yum install postgresql perl-DBD-Pg
  • SQLite: yum install sqlite perl-DBD-SQLite
  • Oracle: yum install perl-DBD-Oracle
  • MySQL: yum install mysql perl-DBD--mysql
  • Firebird: yum install firebird-classic perl-DBD-Firebird perl-Time-HiRes
  • Vertica: yum install perl-DBD-ODBC

Getting Started

Tutorials

The documentation includes an tutorial for each database engine demonstrating the creation, development, and maintenance of a database with Sqitch.

Mail List

Need help? subscribe to the mail list.

Presentations

Sane Database Change Management with Sqitch

A one hour technical introduction to Sqitch, with detailed usage examples to help get you started.

Agile Database Development

Three hour technical tutorial originally presented at PGCon 2013 and updated in January 2014, covering source code control with Git, database change control with Sqitch, and test-driven database development with pgTAP.