class Ryakuzu::ColumnService

Attributes

new_column[RW]
old_column[RW]
table[RW]

Public Class Methods

new(old_column, new_column, table) click to toggle source
# File lib/ryakuzu/services/column_service.rb, line 5
def initialize(old_column, new_column, table)
  @old_column = old_column
  @new_column = new_column
  @table      = table
end

Public Instance Methods

call() click to toggle source
# File lib/ryakuzu/services/column_service.rb, line 11
def call
  text = text_migration
  Ryakuzu::RunMigration.new(old_column: old_column, new_column: new_column).call(new_column, text, 'column')
end

Private Instance Methods

text_migration() click to toggle source
# File lib/ryakuzu/services/column_service.rb, line 18
def text_migration
  "rename_column :#{table.tableize}, :#{old_column}, :#{new_column}"
end