Class: DeclareSchema::SchemaChange::ColumnRename

Inherits:
Base
  • Object
show all
Defined in:
lib/declare_schema/schema_change/column_rename.rb

Instance Method Summary collapse

Methods inherited from Base

#down, format_options, #up

Constructor Details

#initialize(table_name, old_name, new_name) ⇒ ColumnRename

Returns a new instance of ColumnRename.



8
9
10
11
12
# File 'lib/declare_schema/schema_change/column_rename.rb', line 8

def initialize(table_name, old_name, new_name)
  @table_name = table_name
  @old_name = old_name
  @new_name = new_name
end

Instance Method Details

#down_commandObject



18
19
20
# File 'lib/declare_schema/schema_change/column_rename.rb', line 18

def down_command
  "rename_column #{@table_name.to_sym.inspect}, #{@new_name.to_sym.inspect}, #{@old_name.to_sym.inspect}"
end

#up_commandObject



14
15
16
# File 'lib/declare_schema/schema_change/column_rename.rb', line 14

def up_command
  "rename_column #{@table_name.to_sym.inspect}, #{@old_name.to_sym.inspect}, #{@new_name.to_sym.inspect}"
end