class GhostAdapter::Migrator
Public Class Methods
execute(table, query, database, dry_run)
click to toggle source
# File lib/ghost_adapter/migrator.rb, line 11 def self.execute(table, query, database, dry_run) command = GhostAdapter::Command.new( alter: query, table: table, database: database, dry_run: dry_run ) Open3.popen2e(*command.to_a) do |_stdin, stdout_stderr, wait_thread| stdout_stderr.each_line do |line| puts "[gh-ost]:\t\t#{line}" end raise MigrationError, wait_thread.value.exitstatus unless wait_thread.value.success? end # A little buffer time in case of consecutive alter table commands sleep 5 end