Module: FastChangeTable::TableInstanceMethods

Defined in:
lib/fast_change_table/table.rb

Instance Method Summary collapse

Instance Method Details

#initialize(table_name, base) ⇒ Object



3
4
5
6
7
# File 'lib/fast_change_table/table.rb', line 3

def initialize(table_name, base)
  @table_name = table_name
  @base = base
  @renamed_columns = []
end

#rename(column_name, new_column_name) ⇒ Object



13
14
15
16
17
# File 'lib/fast_change_table/table.rb', line 13

def rename(column_name, new_column_name)
  @renamed_columns ||= []
  @renamed_columns << [column_name, new_column_name]
  @base.rename_column(@table_name, column_name, new_column_name)
end

#renamed_columnsObject



9
10
11
# File 'lib/fast_change_table/table.rb', line 9

def renamed_columns
  @renamed_columns || []
end