diff options
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20180707193142_migrate_filters.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/db/migrate/20180707193142_migrate_filters.rb b/db/migrate/20180707193142_migrate_filters.rb index 455ce71ed..10b814c0f 100644 --- a/db/migrate/20180707193142_migrate_filters.rb +++ b/db/migrate/20180707193142_migrate_filters.rb @@ -29,21 +29,21 @@ class MigrateFilters < ActiveRecord::Migration[5.2] whole_word: filter.whole_word, irreversible: true) end - - drop_table :glitch_keyword_mutes end def down - create_table "glitch_keyword_mutes" do |t| - t.references :account, null: false - t.string :keyword, null: false - t.boolean :whole_word, default: true, null: false - t.boolean :apply_to_mentions, default: true, null: false - t.timestamps + unless table_exists? :glitch_keyword_mutes + create_table :glitch_keyword_mutes do |t| + t.references :account, null: false + t.string :keyword, null: false + t.boolean :whole_word, default: true, null: false + t.boolean :apply_to_mentions, default: true, null: false + t.timestamps + end + + add_foreign_key :glitch_keyword_mutes, :accounts, on_delete: :cascade end - add_foreign_key :glitch_keyword_mutes, :accounts, on_delete: :cascade - CustomFilter.where(irreversible: true).find_each do |filter| GlitchKeywordMute.where(account: filter.account).create!( keyword: filter.phrase, |