database_schema
Version information
This version is compatible with:
- Puppet Enterprise 3.x
- RedHat, Ubuntu, Debian, CentOS
Start using this module
Add this module to your Puppetfile:
mod 'cpitman-database_schema', '1.1.0'
Learn more about managing modules with a PuppetfileDocumentation
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.
Dependencies
- puppetlabs/stdlib (>= 3.2.0 < 5.0.0)
- camptocamp/archive (0.x)
- puppetlabs/java (1.x)
The MIT License (MIT) Copyright (c) 2015 Chris Pitman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.