class Ryakuzu::RemoveService
Attributes
column[R]
table[R]
Public Class Methods
new(**options)
click to toggle source
# File lib/ryakuzu/services/remove_service.rb, line 5 def initialize(**options) @table = options[:table] @column = options[:column] end
Public Instance Methods
call()
click to toggle source
# File lib/ryakuzu/services/remove_service.rb, line 10 def call column.blank? ? run_drop_table_migration : run_remove_column_migration end
Private Instance Methods
run_drop_table_migration()
click to toggle source
# File lib/ryakuzu/services/remove_service.rb, line 21 def run_drop_table_migration text = "drop_table :#{table}" Ryakuzu::RunMigration.new(old_table: table).call(table, text, 'table') end
run_remove_column_migration()
click to toggle source
# File lib/ryakuzu/services/remove_service.rb, line 16 def run_remove_column_migration text = "remove_column :#{table}, :#{column}" Ryakuzu::RunMigration.new(old_table: table, old_column: column).call(column, text, 'column') end