database_schema

Manages database schema configuration via standard schema migration tools.

Chris Pitman

cpitman

9,529 downloads

9,088 latest version

4.0 quality score

Version information

  • 1.1.0 (latest)
  • 1.0.0
released Apr 1st 2015
This version is compatible with:
  • Puppet Enterprise 3.x
  • RedHat, Ubuntu, Debian, CentOS

Start using this module

Documentation

cpitman/database_schema — version 1.1.0 Apr 1st 2015

database_schema

This module manages the process of applying database schema migration scripts as part of a puppet manifest. The actual migration process is dispatched to a database migration tool.

The tools currently supported are:

This module can also manage the installation of supported tools.

Getting Started

If you are new to database migration tools and want to get started quickly, start with Flyway. Flyway uses straight sql scripts, where the only requirement is how th files are named (ie "V1SomeScript.sql", "V2AnotherScript.sql"). Use this module to install flyway, and you should be migrating databases in no time at all.

The example below shows how this can be done.

Examples

The following example ensures flyway is installed and that migrations have been applied to a MySql database.

include ::database_schema::flyway

database_schema::flyway_migration { 'Migrate TestDB':
  db_username   => root,
  db_password   => password,
  jdbc_url      => 'jdbc:mysql://localhost/testdb',
  schema_source => '/vagrant/tests/data/stage1'
}

The following example will only migrate up to version 1.2

include ::database_schema::flyway

database_schema::flyway_migration { 'Migrate TestDB':
  db_username   => root,
  db_password   => password,
  jdbc_url      => 'jdbc:mysql://localhost/testdb',
  schema_source => '/vagrant/tests/data/stage1',
  ensure        => '1.2'
}

Limitations

  • flyway_migration currently only supports SQL based migrations.
  • liquibase installs liquibase but not any jdbc drivers. These need to be installed to the lib folder of liquibase for the database in use.