Backfill work_item_transitions table
What does this MR do and why?
Backfill work_item_transitions table
This creates a record for each issue on the work_item_transitions table and backfills it with the correct values.
Changelog: added
References
Issue: #558755 (closed)
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
Before
select count(*) from work_item_transitions;
count
-------
0
Note: Since we have a trigger for the table, there might be some records already in your local database.
Run Migration
in/rails db:migrate
main: == [advisory_lock_connection] object_id: 147740, pg_backend_pid: 7256
main: == 20250819150000 QueueBackfillWorkItemTransitions: migrating =================
main: == 20250819150000 QueueBackfillWorkItemTransitions: migrated (0.0586s) ========
main: == [advisory_lock_connection] object_id: 147740, pg_backend_pid: 7256
Check Data
select count(*) from work_item_transitions;
count
--------
212991
(1 row)
select count(*) from issues JOIN work_item_transitions ON (issues.id = work_item_transitions.work_item_id);
count
--------
212991
(1 row)
gitlabhq_development=# select count(*) from issues JOIN work_item_transitions wt ON (issues.id = wt.work_item_id) WHERE wt.promoted_to_epic_id <> issues.promoted_to_epic_id OR wt.moved_to_id <> issues.moved_to_id OR wt.duplicated_to_id <> issues.duplicated_to_id;
count
-------
0
(1 row)
Rollback Migration
bin/rails db:rollback:main VERSION=20250819150000
main: == [advisory_lock_connection] object_id: 147820, pg_backend_pid: 7174
main: == 20250819150000 QueueBackfillWorkItemTransitions: reverting =================
main: == 20250819150000 QueueBackfillWorkItemTransitions: reverted (0.0478s) ========
main: == [advisory_lock_connection] object_id: 147820, pg_backend_pid: 7174
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Nicolas Dular