Created
September 11, 2019 04:41
-
-
Save furaji/c02737cb62a660ee17533b0000510187 to your computer and use it in GitHub Desktop.
ridgepole_migrate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'pathname' | |
| require 'fileutils' | |
| include FileUtils | |
| # path to your application root. | |
| APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) | |
| def system!(*args) | |
| system(*args) || abort("\n== Command #{args} failed ==") | |
| end | |
| chdir APP_ROOT do | |
| system! 'ridgepole -c config/database.yml --apply --dry-run -f Schemafile' | |
| puts '------------' | |
| puts 'apply? [y/n]' | |
| puts '------------' | |
| case gets.chomp | |
| when 'yes', 'YES', 'y' | |
| system! 'ridgepole -c config/database.yml --apply -f Schemafile' | |
| system! 'ridgepole -c config/database.yml --apply -f Schemafile -E test' | |
| system! 'ridgepole -c config/database.yml --export -o Schemafile' | |
| system! 'bundle exec annotate' | |
| when 'no', 'NO', 'n' | |
| exit 1 | |
| else | |
| exit 1 | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment