bin/ridgepole in ridgepole-0.6.4.beta vs bin/ridgepole in ridgepole-0.6.4.beta2

- old
+ new

@@ -40,16 +40,19 @@ set_mode = proc do |m| raise 'More than one mode is specified' if mode mode = m end -def noop_migrate(delta) +def noop_migrate(delta, options) unless delta.script.empty? puts delta.script + "\n\n" end - migrated, out = delta.migrate(:noop => true) + migrated, out = delta.migrate( + :noop => true, + :alter_extra => options[:alter_extra] + ) if migrated out.each_line do |line| if line =~ /\A\s+/ puts "# #{line}" @@ -69,10 +72,11 @@ opt.on('-a', '--apply') { set_mode[:apply] } opt.on('-m', '--merge') { set_mode[:apply]; options[:merge] = true } opt.on('-f', '--file FILE') {|v| file = v } opt.on('', '--dry-run') { options[:dry_run] = true } opt.on('', '--table-options OPTIONS') {|v| options[:table_options] = v } + opt.on('', '--alter-extra ALTER_SPEC') {|v| options[:alter_extra] = v } opt.on('', '--external-script SCRIPT') {|v| options[:external_script] = v } opt.on('', '--bulk-change') { raise "Cannot use `bulk-change` in `merge`" if options[:merge] options[:bulk_change] = true } @@ -104,10 +108,11 @@ opt.on('', '--with-apply') { diff_with_apply = true } opt.on('-o', '--output FILE') {|v| output_file = v } opt.on('-t', '--tables TABLES', Array) {|v| options[:tables] = v } opt.on('', '--ignore-tables TABLES', Array) {|v| options[:ignore_tables] = v.map {|i| Regexp.new(i) } } opt.on('', '--enable-mysql-awesome') { options[:enable_mysql_awesome] = true } + opt.on('', '--mysql-use-alter') { options[:mysql_use_alter] = true } opt.on('', '--dump-without-table-options') { options[:dump_without_table_options] = true } opt.on('', '--index-removed-drop-column') { options[:index_removed_drop_column] = true } opt.on('', '--enable-migration-comments') { options[:enable_migration_comments] = true } opt.on('-r', '--require LIBS', Array) {|v| v.each {|i| require i } } opt.on('' , '--log-file LOG_FILE') {|v| options[:log_file] = v } @@ -194,15 +199,19 @@ delta = client.diff(dsl, :path => file) differ = delta.differ? if options[:dry_run] if differ - differ = noop_migrate(delta) + differ = noop_migrate(delta, options) end else logger.verbose_info('# Update schema') - differ, out = delta.migrate(:external_script => options[:external_script]) + + differ, out = delta.migrate( + :external_script => options[:external_script], + :alter_extra => options[:alter_extra] + ) end unless differ logger.info('No change') end @@ -233,10 +242,10 @@ if differ logger.info('No change') end elsif delta.differ? - differ = noop_migrate(delta) + differ = noop_migrate(delta, options) exit_code = 1 if differ end end rescue => e if options[:debug]