Class: PerconaAr::Connection
- Inherits:
-
ActiveRecord::ConnectionAdapters::Mysql2Adapter
- Object
- ActiveRecord::ConnectionAdapters::Mysql2Adapter
- PerconaAr::Connection
- Defined in:
- lib/percona_ar/connection.rb
Instance Method Summary collapse
- #execute(sql, name = nil) ⇒ Object
-
#initialize(conn) ⇒ Connection
constructor
A new instance of Connection.
- #not_implemented ⇒ Object (also: #create_table, #remove_table, #change_table, #create_join_table)
Constructor Details
#initialize(conn) ⇒ Connection
Returns a new instance of Connection.
2 3 4 5 6 7 8 9 |
# File 'lib/percona_ar/connection.rb', line 2 def initialize(conn) super( conn.instance_variable_get(:@connection), Logger.new("/dev/null"), conn.instance_variable_get(:@connection_options), conn.instance_variable_get(:@config) ) end |
Instance Method Details
#execute(sql, name = nil) ⇒ Object
11 12 13 14 |
# File 'lib/percona_ar/connection.rb', line 11 def execute(sql, name = nil) return super unless sql =~ /^ALTER TABLE.*/ PerconaAr::PtOnlineSchemaChangeExecutor.new(sql).call end |
#not_implemented ⇒ Object Also known as: create_table, remove_table, change_table, create_join_table
16 17 18 19 20 |
# File 'lib/percona_ar/connection.rb', line 16 def not_implemented(*) raise NotImplementedError.new( "This is not implemented with the percona tool, please use a standard migration" ) end |