Method: RR::ReplicationInitializer#restore_unconfigured_tables
- Defined in:
- lib/rubyrep/replication_initializer.rb
#restore_unconfigured_tables(configured_table_pairs = session.configured_table_pairs) ⇒ Object
Checks for tables that have triggers but are not in the list of configured tables. Removes triggers and restores sequences of those tables.
-
configured_table_pairs
: An array of table pairs (e. g. [=> ‘xy’, :right => ‘xy2’]).
256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/rubyrep/replication_initializer.rb', line 256 def restore_unconfigured_tables(configured_table_pairs = session.configured_table_pairs) [:left, :right].each do |database| configured_tables = configured_table_pairs.map {|table_pair| table_pair[database]} unconfigured_tables = session.send(database).tables - configured_tables unconfigured_tables.each do |table| if trigger_exists?(database, table) drop_trigger(database, table) session.send(database).execute( "delete from #{[:rep_prefix]}_pending_changes where change_table = '#{table}'") end clear_sequence_setup(database, table) end end end |