about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20191118044943_remove_old_filter_columns.rb10
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