cookbook 'flywaydb', '= 5.0.0'
flywaydb
(30) Versions
5.0.0
-
Follow3
Installs and configures flywaydb database migration tool
cookbook 'flywaydb', '= 5.0.0', :supermarket
knife supermarket install flywaydb
knife supermarket download flywaydb
Flywaydb Cookbook
Installs flywaydb and allows for execution of flyway commands via resource actions.
Requirements
- Chef 11+
Platforms
- CentOS/RedHat
- Ubuntu
- Windows
Usage
Include default recipe in cookbook or run list to install flywaydb.
Attributes
-
node['flywaydb']['version']
- The flywaydb version to install. Default4.0
. -
node['flywaydb']['sha256']
- The flywaydb SHA 256 checksum for linux or windows platform. -
node['flywaydb']['install_dir']
- The base install directory. Default linux:/opt/flyway
windows:C:\flyway
. -
node['flywaydb']['user']
- The owner of flywaydb. Defaultflyway
. -
node['flywaydb']['group']
- The group of flywaydb. Defaultflyway
.
Resources
Use migrate, info, validate, baseline, or repair actions to install flywaydb and execute associated flyway command.
Attributes
-
flyway_conf
- Flyway configuration path or settings to copy or create#{install_dir}/conf/flyway.conf
. Settings in alt_conf override settings in flyway.conf. Settings in params override all settings. Default:nil
. -
alt_conf
- Alternative configuration path or settings. An array containing paths and/or settings is also supported. Each path and settings are written as#{install_dir}/conf/#{name}[_#{i + 1}].conf
where name is the resource name and i is the index in array. Each item in array will result in an independent execution of Flyway. Settings in alt_conf override settings in flyway.conf. Settings in params override all settings. Default:nil
. -
params
- Command-line parameters to pass to flyway command. Settings in params override all settings. Default:{}
. -
name
- Name of the alternative conf file when alt_conf is defined. Defaults to resource block name. -
debug
- Print debug output during execution of flyway commands. Default:false
. -
sensitive
- Suppress logging the Flyway command executed to hide sensitive information but still log Flyway stdout and stderr to Chef-client. Writing of conf files will also be suppressed when executing with Chef-client versions that support sensitive. Default:true
.
Examples
Single migration using settings
flywaydb 'myapp' do flyway_conf( url: 'jdbc:mysql/localhost/mydb', user: 'root', locations: 'filesystem:/opt/myapp/db/migration', cleanDisabled: true ) action :migrate end
Single migration using path
flywaydb 'myapp' do flyway_conf( '/opt/myapp/db/flyway.conf' ) action :migrate end
Multiple migrations using settings with alt_conf and params
flywaydb 'myapp' do flyway_conf( user: 'root', url: 'jdbc:mysql/localhost/mysql' ) alt_conf( { schemas: 'custA', locations: 'filesystem:/opt/myapp/db/migration/core,/opt/myapp/db/migration/custA' }, { schemas: 'custB', locations: 'filesystem:/opt/myapp/db/migration/core,/opt/myapp/db/migration/custB' } ) params( password: password ) action :migrate end
Multiple migrations using paths with alt_conf and params
flywaydb 'myapp' do flyway_conf( '/opt/myapp/db/flyway.conf' ) alt_conf( '/opt/myapp/db/custA.conf', '/opt/myapp/db/custB.conf' ) params( password: password ) action :migrate end
ChefSpec Matchers
This cookbook includes custom ChefSpec matchers you can use to test
your own cookbooks.
Example Matcher Usage
expect(chef_run).to migrate_flywaydb('flyway').with( flyway_conf_: { 'user' => 'root', 'url' => 'jdbc:mysql://localhost/mysql' } alt_conf: [ { 'schemas' => 'custA', 'locations' => 'filesystem:/opt/myapp/db/migration/core,/opt/myapp/db/migration/custA' }, { 'schemas' => 'custB', 'locations' => 'filesystem:/opt/myapp/db/migration/core,/opt/myapp/db/migration/custB' } ], params: { 'password' => 'password' } debug: false, sensitive: true )
Cookbook Matchers
- migrate_flywaydb(resource_name)
- clean_flywaydb(resource_name)
- baseline_flywaydb(resource_name)
- info_flywaydb(resource_name)
- repair_flywaydb(resource_name)
- validate_flywaydb(resource_name)
Getting Help
- Ask specific questions on Stack Overflow.
- Report bugs and discuss potential features in Github issues.
Contributing
Please refer to CONTRIBUTING.
License
MIT - see the accompanying LICENSE file for details.
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
CHANGELOG
5.0.0 2016-04-15
- Add flyway_conf attribute
- Add alt_conf attribute
- Remove conf and ext_conf attributes
4.1.0 2016-04-14
- Fix #6 Suppress the command that was executed to hide sensitive information but still log stdout and stderr
4.0.1 2016-04-12
- Include default recipe in provide only if required
4.0.0 2016-03-24
- Fix #4 Quote param values to avoid interpretation by the shell
3.1.0 2016-03-09
- Use Flyway 4.0
3.0.1 2016-03-08
- Fix #3 sensitive not defaulting to true
- Fix clean action
3.0.0 2016-02-20
- Remove global attributes ext_conf, conf, params, sensitive, and debug
- Default sensitive to true
2.0.0 2016-02-10
- Remove command recipes
1.0.0 2016-02-04
- Initial release
Foodcritic Metric
5.0.0 passed this metric
5.0.0 passed this metric