Class: Lhm::Migration
- Inherits:
-
Object
- Object
- Lhm::Migration
- Defined in:
- lib/lhm/migration.rb
Instance Attribute Summary collapse
-
#conditions ⇒ Object
readonly
Returns the value of attribute conditions.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#renames ⇒ Object
readonly
Returns the value of attribute renames.
Instance Method Summary collapse
- #archive_name ⇒ Object
- #destination_columns ⇒ Object
- #destination_name ⇒ Object
-
#initialize(origin, destination, conditions = nil, renames = {}, time = Time.now, generated_column_names = []) ⇒ Migration
constructor
A new instance of Migration.
- #intersection ⇒ Object
- #origin_columns ⇒ Object
- #origin_name ⇒ Object
Constructor Details
#initialize(origin, destination, conditions = nil, renames = {}, time = Time.now, generated_column_names = []) ⇒ Migration
Returns a new instance of Migration.
11 12 13 14 15 16 17 18 |
# File 'lib/lhm/migration.rb', line 11 def initialize(origin, destination, conditions = nil, renames = {}, time = Time.now, generated_column_names = []) @origin = origin @destination = destination @conditions = conditions @renames = renames @table_name = TableName.new(@origin.name, time) @generated_column_names = generated_column_names end |
Instance Attribute Details
#conditions ⇒ Object (readonly)
Returns the value of attribute conditions.
9 10 11 |
# File 'lib/lhm/migration.rb', line 9 def conditions @conditions end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
9 10 11 |
# File 'lib/lhm/migration.rb', line 9 def destination @destination end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
9 10 11 |
# File 'lib/lhm/migration.rb', line 9 def origin @origin end |
#renames ⇒ Object (readonly)
Returns the value of attribute renames.
9 10 11 |
# File 'lib/lhm/migration.rb', line 9 def renames @renames end |
Instance Method Details
#archive_name ⇒ Object
20 21 22 |
# File 'lib/lhm/migration.rb', line 20 def archive_name @archive_name ||= @table_name.archived end |
#destination_columns ⇒ Object
40 41 42 |
# File 'lib/lhm/migration.rb', line 40 def destination_columns @destination_columns ||= intersection.destination.joined end |
#destination_name ⇒ Object
36 37 38 |
# File 'lib/lhm/migration.rb', line 36 def destination_name @destination_name ||= destination.name end |
#intersection ⇒ Object
24 25 26 |
# File 'lib/lhm/migration.rb', line 24 def intersection Intersection.new(@origin, @destination, @renames, @generated_column_names) end |
#origin_columns ⇒ Object
32 33 34 |
# File 'lib/lhm/migration.rb', line 32 def origin_columns @origin_columns ||= intersection.origin.typed(origin_name) end |
#origin_name ⇒ Object
28 29 30 |
# File 'lib/lhm/migration.rb', line 28 def origin_name @table_name.original end |