Class: DeclareSchema::SchemaChange::TableChange
- Inherits:
-
Base
- Object
- Base
- DeclareSchema::SchemaChange::TableChange
show all
- Defined in:
- lib/declare_schema/schema_change/table_change.rb
Instance Method Summary
collapse
Methods inherited from Base
#down, format_options, #up
Constructor Details
#initialize(table_name, old_options, new_options) ⇒ TableChange
Returns a new instance of TableChange.
12
13
14
15
16
17
18
19
|
# File 'lib/declare_schema/schema_change/table_change.rb', line 12
def initialize(table_name, old_options, new_options)
old_options.is_a?(Hash) or raise ArgumentError, "old_options must be a Hash but is: #{old_options.inspect}"
new_options.is_a?(Hash) or raise ArgumentError, "new_options must be a Hash but is: #{new_options.inspect}"
@table_name = table_name
@old_options = old_options
@new_options = new_options
end
|
Instance Method Details
#down_command ⇒ Object
25
26
27
|
# File 'lib/declare_schema/schema_change/table_change.rb', line 25
def down_command
alter_table(@table_name, @old_options)
end
|
#up_command ⇒ Object
21
22
23
|
# File 'lib/declare_schema/schema_change/table_change.rb', line 21
def up_command
alter_table(@table_name, @new_options)
end
|