discourse/db
Krzysztof Kotlarek 67305dc7bb
DEV: Persist flags_id_seq start value in structure.sql (#40109)
The original `CreateFlags` migration bumped `flags_id_seq` to 1001 via
`setval` so non-system flags get IDs >= 1001, reserving 1-999 for system
flags.

`pg_dump --schema-only` (which Rails uses to generate `structure.sql`)
captures the sequence's `seqstart` metadata but omits runtime `setval`
calls. As a result, fresh installs provisioned from `structure.sql` saw
the sequence start at 1 instead of 1001.

This migration uses `ALTER SEQUENCE ... START WITH` to update the
sequence's metadata so the value is preserved in subsequent
`structure.sql` dumps. `RESTART` is intentionally omitted: existing
sites may already have `last_value` well past 1001, and rewinding would
cause id collisions on the next insert.
2026-05-18 17:13:40 +08:00
..
fixtures DEV: Skip backfill INSERTs in old migrations on fresh installs (#39976) 2026-05-13 13:59:28 +01:00
migrate DEV: Persist flags_id_seq start value in structure.sql (#40109) 2026-05-18 17:13:40 +08:00
post_migrate UX: Allow more specific enabled for options for upcoming changes (#39916) 2026-05-13 10:22:06 +10:00
api_test_seeds.rb
structure.sql DEV: Persist flags_id_seq start value in structure.sql (#40109) 2026-05-18 17:13:40 +08:00