Skip to content

A platform for community discussion. Free, open, simple.

DEV: Persist flags_id_seq start value in structure.sql (#40109)

Krzysztof Kotlarek67305dc7bb78
diff --git a/db/migrate/20260518054805_fix_flags_id_seq_start.rb b/db/migrate/20260518054805_fix_flags_id_seq_start.rb
new file mode 100644
index 00000000000..e2fddfcda60
--- /dev/null
+++ b/db/migrate/20260518054805_fix_flags_id_seq_start.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class FixFlagsIdSeqStart < ActiveRecord::Migration[8.0]
+ MAX_SYSTEM_FLAG_ID = 1000
+
+ def up
+ execute "ALTER SEQUENCE flags_id_seq START WITH #{MAX_SYSTEM_FLAG_ID + 1}"
+ end
+
+ def down
+ raise ActiveRecord::IrreversibleMigration
+ end
+end
diff --git a/db/structure.sql b/db/structure.sql
index b3c2a87fd07..e5567d3c7d5 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -4576,7 +4576,7 @@ CREATE TABLE public.flags (
--
CREATE SEQUENCE public.flags_id_seq
- START WITH 1
+ START WITH 1001
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
@@ -20861,6 +20861,7 @@ ALTER TABLE ONLY public.ad_plugin_house_ads_groups
SET search_path TO "$user", public;
INSERT INTO "schema_migrations" (version) VALUES
+('20260518054805'),
('20260514055648'),
('20260514043815'),
('20260513105516'),