Class: DataMigrations::Instruction::Copy

Inherits:
Base
  • Object
show all
Defined in:
lib/data_migrations/instruction/copy.rb

Instance Attribute Summary

Attributes inherited from Base

#columns, #migration, #options

Instance Method Summary collapse

Methods inherited from Base

#execute

Constructor Details

#initialize(migration, *columns) ⇒ Copy

Returns a new instance of Copy.



4
5
6
7
8
9
# File 'lib/data_migrations/instruction/copy.rb', line 4

def initialize(migration, *columns)
  super(migration)
  self.options = columns.extract_options!
  options[:to] = [nil].concat(Array(options[:to]) || [])
  self.columns = ['id'].concat(columns)
end

Instance Method Details

#statementsObject



11
12
13
# File 'lib/data_migrations/instruction/copy.rb', line 11

def statements
  [update_statement, insert_statement]
end