Class: Migsupo::Differ::Operations::RenameColumn

Inherits:
Object
  • Object
show all
Defined in:
lib/migsupo/differ/operations/rename_column.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table_name:, old_name:, new_name:) ⇒ RenameColumn

Returns a new instance of RenameColumn.



7
8
9
10
11
12
# File 'lib/migsupo/differ/operations/rename_column.rb', line 7

def initialize(table_name:, old_name:, new_name:)
  @table_name = table_name.to_s
  @old_name   = old_name.to_s
  @new_name   = new_name.to_s
  freeze
end

Instance Attribute Details

#new_nameObject (readonly)

Returns the value of attribute new_name.



5
6
7
# File 'lib/migsupo/differ/operations/rename_column.rb', line 5

def new_name
  @new_name
end

#old_nameObject (readonly)

Returns the value of attribute old_name.



5
6
7
# File 'lib/migsupo/differ/operations/rename_column.rb', line 5

def old_name
  @old_name
end

#table_nameObject (readonly)

Returns the value of attribute table_name.



5
6
7
# File 'lib/migsupo/differ/operations/rename_column.rb', line 5

def table_name
  @table_name
end

Instance Method Details

#migration_typeObject



14
15
16
# File 'lib/migsupo/differ/operations/rename_column.rb', line 14

def migration_type
  :rename_column
end

#reversible?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/migsupo/differ/operations/rename_column.rb', line 18

def reversible?
  true
end

#to_sObject



22
23
24
# File 'lib/migsupo/differ/operations/rename_column.rb', line 22

def to_s
  "rename_column #{table_name}.#{old_name} -> #{new_name}"
end