-
-
Save winebarrel/8651edb841cdd7eefa5ab65158466acc to your computer and use it in GitHub Desktop.
pt-osc+migration
This file contains 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
class PtOsc < Arproxy::Base | |
def execute(sql, name=nil) | |
if sql =~ %r|\A/\*\ pt\-osc\ \*/(.+)| | |
info = JSON.parse($1) | |
system( | |
'pt-online-schema-change', | |
'--alter', info['alter'], | |
"D=hello_development,t=#{info['table']}", | |
'--recursion-method', 'none', | |
'--user', 'root', | |
'--execute') | |
nil | |
else | |
super(sql, name) | |
end | |
end | |
end | |
Arproxy.configure do |config| | |
config.adapter = "mysql2" | |
config.use PtOsc | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment