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) ⇒ 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) ⇒ Migration
Returns a new instance of Migration.
11 12 13 14 15 16 17 |
# File 'lib/lhm/migration.rb', line 11 def initialize(origin, destination, conditions = nil, renames = {}, time = Time.now) @origin = origin @destination = destination @conditions = conditions @renames = renames @table_name = TableName.new(@origin.name, time) 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
19 20 21 |
# File 'lib/lhm/migration.rb', line 19 def archive_name @archive_name ||= @table_name.archived end |
#destination_columns ⇒ Object
39 40 41 |
# File 'lib/lhm/migration.rb', line 39 def destination_columns @destination_columns ||= intersection.destination.joined end |
#destination_name ⇒ Object
35 36 37 |
# File 'lib/lhm/migration.rb', line 35 def destination_name @destination_name ||= destination.name end |
#intersection ⇒ Object
23 24 25 |
# File 'lib/lhm/migration.rb', line 23 def intersection Intersection.new(@origin, @destination, @renames) end |
#origin_columns ⇒ Object
31 32 33 |
# File 'lib/lhm/migration.rb', line 31 def origin_columns @origin_columns ||= intersection.origin.typed(origin_name) end |
#origin_name ⇒ Object
27 28 29 |
# File 'lib/lhm/migration.rb', line 27 def origin_name @table_name.original end |