-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3114 from nebulab/drop-table-from-20180710170104
Add migration to drop table/column from `20180710170104`
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
core/db/migrate/20190220093635_drop_spree_store_credit_update_reasons.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
class DropSpreeStoreCreditUpdateReasons < ActiveRecord::Migration[5.1] | ||
# This migration should run in a subsequent deploy after 20180710170104 | ||
# has been already deployed. See also migration 20180710170104. | ||
|
||
# We can't add back the table in a `down` method here: a previous version | ||
# of migration 20180710170104 would fail with `table already exists` , as | ||
# it handles itself the add/remove of this table and column. | ||
def up | ||
if table_exists? :spree_store_credit_update_reasons | ||
drop_table :spree_store_credit_update_reasons | ||
end | ||
|
||
if column_exists? :spree_store_credit_events, :update_reason_id | ||
remove_column :spree_store_credit_events, :update_reason_id | ||
end | ||
end | ||
end |