Class: DataMigrations::Instruction::Base

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

Direct Known Subclasses

Copy, Exec, Remove, Set

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(migration) ⇒ Base

Returns a new instance of Base.



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

def initialize(migration)
  @migration = migration
end

Instance Attribute Details

#columnsObject

Returns the value of attribute columns.



4
5
6
# File 'lib/data_migrations/instruction/base.rb', line 4

def columns
  @columns
end

#migrationObject (readonly)

Returns the value of attribute migration.



9
10
11
# File 'lib/data_migrations/instruction/base.rb', line 9

def migration
  @migration
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/data_migrations/instruction/base.rb', line 4

def options
  @options
end

Instance Method Details

#executeObject



21
22
23
24
25
26
# File 'lib/data_migrations/instruction/base.rb', line 21

def execute
  statements.each do |statement|
    puts "Executing: #{statement}"
    connection.execute(statement)
  end
end