Forge Home

database_schema

Manages database schema configuration via standard schema migration tools.

10,665 downloads

10,161 latest version

4.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

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

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'cpitman-database_schema', '1.1.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add cpitman-database_schema
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install cpitman-database_schema --version 1.1.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

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.