Sha256: 81d600c0142089e3ba59b19669ba84d55467e11f3aed4c939de9ce301f7a9524
Contents?: true
Size: 645 Bytes
Versions: 2
Compression:
Stored size: 645 Bytes
Contents
module Ryakuzu class RemoveService attr_reader :table, :column def initialize(**options) @table = options[:table] @column = options[:column] end def call column.blank? ? run_drop_table_migration : run_remove_column_migration end private def run_remove_column_migration text = "remove_column :#{table}, :#{column}" Ryakuzu::RunMigration.new(old_table: table, old_column: column).call(column, text, 'column') end def run_drop_table_migration text = "drop_table :#{table}" Ryakuzu::RunMigration.new(old_table: table).call(table, text, 'table') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ryakuzu-0.3.0 | lib/ryakuzu/services/remove_service.rb |
ryakuzu-0.2.6 | app/services/ryakuzu/remove_service.rb |