diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-11-18 02:52:17 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-11-18 02:52:17 -0600 |
commit | f1230bb319004e77cba2bf6419ae919d0c02b6c5 (patch) | |
tree | cf90387654de94ec4ad7da804d88ec43c563ea4d /db/migrate | |
parent | 0d90c0f61a8cc59d1719f690252890f16952c13e (diff) |
Migrate old whole-word filters to modified syntax (double quoted strings treated as whole-word).
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20191118044943_remove_old_filter_columns.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/db/migrate/20191118044943_remove_old_filter_columns.rb b/db/migrate/20191118044943_remove_old_filter_columns.rb index b5236e7a4..446f45325 100644 --- a/db/migrate/20191118044943_remove_old_filter_columns.rb +++ b/db/migrate/20191118044943_remove_old_filter_columns.rb @@ -1,5 +1,9 @@ class RemoveOldFilterColumns < ActiveRecord::Migration[5.2] - def change + def up + CustomFilters.find_each do |filter| + filter.update!(phrase: "\"#{filter.phrase}\"") if filter.whole_word + end + safety_assured { remove_column :custom_filters, :no_desc remove_column :custom_filters, :desc @@ -15,4 +19,8 @@ class RemoveOldFilterColumns < ActiveRecord::Migration[5.2] remove_column :custom_filters, :irreversible } end + + def down + raise ActiveRecord::IrreversibleMigration + end end |