FIX: Reintroduce auto_silence_first_post_regex (#12223)

Follow-up to 533800a87b.
This commit is contained in:
Bianca Nenciu
2021-02-26 15:07:04 +02:00
committed by GitHub
parent 45c5fd2172
commit 4b0496b2fc
5 changed files with 46 additions and 24 deletions

View File

@@ -1,24 +0,0 @@
# frozen_string_literal: true
class MoveAutoSilenceFirstPostRegexToWatchedWords < ActiveRecord::Migration[6.0]
def up
execute <<~SQL
INSERT INTO watched_words (word, action, created_at, updated_at)
SELECT value, 3, created_at, updated_at
FROM site_settings
WHERE name = 'auto_silence_first_post_regex'
ON CONFLICT DO NOTHING
SQL
execute <<~SQL
INSERT INTO watched_words (word, action, created_at, updated_at)
SELECT unnest(string_to_array(value, '|')), 3, created_at, updated_at
FROM site_settings
WHERE name = 'auto_silence_first_post_regex'
ON CONFLICT DO NOTHING
SQL
end
def down
end
end