Fix crash when adding a new filter (#18894)

Fixes #18742
This commit is contained in:
Claire 2022-08-27 17:41:20 +02:00 committed by GitHub
parent db8125a1b3
commit a24c6e5b3d

View file

@ -0,0 +1,20 @@
# frozen_string_literal: true
class FixCustomFilterKeywordsIdSeq < ActiveRecord::Migration[6.1]
disable_ddl_transaction!
def up
# 20220613110711 manually inserts items with set `id` in the database, but
# we also need to bump the sequence number, otherwise
safety_assured do
execute <<-SQL.squish
BEGIN;
LOCK TABLE custom_filter_keywords IN EXCLUSIVE MODE;
SELECT setval('custom_filter_keywords_id_seq'::regclass, id) FROM custom_filter_keywords ORDER BY id DESC LIMIT 1;
COMMIT;
SQL
end
end
def down; end
end