diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20180707193142_migrate_filters.rb | 20 | ||||
-rw-r--r-- | db/post_migrate/20180813160548_post_migrate_filters.rb | 11 | ||||
-rw-r--r-- | db/schema.rb | 2 |
3 files changed, 22 insertions, 11 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, diff --git a/db/post_migrate/20180813160548_post_migrate_filters.rb b/db/post_migrate/20180813160548_post_migrate_filters.rb new file mode 100644 index 000000000..588548c1d --- /dev/null +++ b/db/post_migrate/20180813160548_post_migrate_filters.rb @@ -0,0 +1,11 @@ +class PostMigrateFilters < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def up + drop_table :glitch_keyword_mutes if table_exists? :glitch_keyword_mutes + end + + def down + end +end + diff --git a/db/schema.rb b/db/schema.rb index 952582255..c2a313ffa 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2018_08_12_123222) do +ActiveRecord::Schema.define(version: 2018_08_13_160548) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" |