Add a migration to fix sequence ownership for CI builds migration
What does this MR do and why?
GitLab 17.2 shipped a migration
(!158711 (merged)) that
dropped p_ci_builds.id
. However, we received a number of reports of
users who had unrelated sequences owned by p_ci_builds.id
, so the
migration failed because the objects depended on that column existing.
To allow migrations to go through, scan the system catalog for all
sequences owned by either p_ci_builds
or ci_builds
. Generate the
ALTER SEQUENCE
statement to update the ownership of the sequence
using the technique described in
https://wiki.postgresql.org/wiki/Fixing_Sequences.
Note that we could run all 600+ ALTER SEQUENCE
commands to bring the
database to a consistent state, but to minimize any changes we focus
only on the ones to allow upgrades to proceed.
Relates to #468541 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.