class Ryakuzu::AddColumnService

Attributes

column[R]
table[R]
type[R]

Public Class Methods

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

Public Instance Methods

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

Private Instance Methods

text_migration() click to toggle source
# File lib/ryakuzu/services/add_column_service.rb, line 18
def text_migration
  "add_column :#{table.tableize}, :#{column}, :#{type.downcase.to_sym}"
end