Class: Lhm::Invoker
Overview
Copies an origin table to an altered destination table. Live activity is synchronized into the destination table using triggers.
Once the origin and destination tables have converged, origin is archived and replaced by destination.
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#migrator ⇒ Object
readonly
Returns the value of attribute migrator.
Instance Method Summary collapse
-
#initialize(origin, connection) ⇒ Invoker
constructor
A new instance of Invoker.
- #run(options = {}) ⇒ Object
Methods included from SqlHelper
#annotation, #idx_name, #idx_spec, #sql, #table?, #update, #version_string
Constructor Details
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
19 20 21 |
# File 'lib/lhm/invoker.rb', line 19 def connection @connection end |
#migrator ⇒ Object (readonly)
Returns the value of attribute migrator.
19 20 21 |
# File 'lib/lhm/invoker.rb', line 19 def migrator @migrator end |
Instance Method Details
#run(options = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/lhm/invoker.rb', line 26 def run( = {}) if !.include?(:atomic_switch) if supports_atomic_switch? [:atomic_switch] = true else raise Error.new( "Using mysql #{version_string}. You must explicitly set " + "options[:atomic_switch] (re SqlHelper#supports_atomic_switch?)") end end migration = @migrator.run Entangler.new(migration, @connection).run do Chunker.new(migration, @connection, ).run if [:atomic_switch] AtomicSwitcher.new(migration, @connection).run else LockedSwitcher.new(migration, @connection).run end end end |