Class: MergeDb::Merger

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_db/merger.rb

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Merger

Returns a new instance of Merger.



10
11
12
13
# File 'lib/merge_db/merger.rb', line 10

def initialize(params)
  @source_name = params[:source]
  @target_name = params[:target]
end

Instance Method Details

#mergeObject



19
20
21
22
23
24
# File 'lib/merge_db/merger.rb', line 19

def merge
  add_db_to_scope
  copy_data_from_source_to_target
  restore_association_references
  clean_backedup_primary_keys
end

#prepareObject



15
16
17
# File 'lib/merge_db/merger.rb', line 15

def prepare
  prepare_tables_in_target
end

#restore_associationsObject



26
27
28
29
# File 'lib/merge_db/merger.rb', line 26

def restore_associations
  restore_association_references
  clean_backedup_primary_keys
end