about summary refs log tree commit diff
path: root/db/migrate/20180707154237_add_whole_word_to_custom_filter.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-07-09 02:22:09 +0200
committerEugen Rochko <eugen@zeonfederated.com>2018-07-09 02:22:09 +0200
commit1ca4e51eb38de6de81cedf3ddcdaa626f1d1c569 (patch)
tree3cf44ef95b178d233fd34d2ec2aae2a7021c159d /db/migrate/20180707154237_add_whole_word_to_custom_filter.rb
parent451e585b9720c61ef9a155a16484b25ded79d512 (diff)
Add option to not consider word boundaries when processing keyword filtering (#7975)
* Add option to not consider word boundaries when filtering phrases

* Add a few tests for keyword/phrase filtering
Diffstat (limited to 'db/migrate/20180707154237_add_whole_word_to_custom_filter.rb')
-rw-r--r--db/migrate/20180707154237_add_whole_word_to_custom_filter.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20180707154237_add_whole_word_to_custom_filter.rb b/db/migrate/20180707154237_add_whole_word_to_custom_filter.rb
new file mode 100644
index 000000000..63ecb8741
--- /dev/null
+++ b/db/migrate/20180707154237_add_whole_word_to_custom_filter.rb
@@ -0,0 +1,17 @@
+require Rails.root.join('lib', 'mastodon', 'migration_helpers')
+
+class AddWholeWordToCustomFilter < ActiveRecord::Migration[5.2]
+  include Mastodon::MigrationHelpers
+
+  disable_ddl_transaction!
+
+  def change
+    safety_assured do
+      add_column_with_default :custom_filters, :whole_word, :boolean, default: true, allow_null: false
+    end
+  end
+
+  def down
+    remove_column :custom_filters, :whole_word
+  end
+end