Update ci_builds_runner_session FK to include partition_id
What does this MR do and why?
It updates the foreign key between ci_builds_runner_session
and ci_builds
to use the partitioning column.
The migrations were generated with !109130 (merged)
This table does not require explicit cleaup for #387301 (closed) because the partition_id values are consistent between the record and the migration to partition_id=100
can be executed by the cascade trigger.
gitlabhq_dblab=# select id, build_id, partition_id from ci_builds_runner_session where partition_id = 101;
id | build_id | partition_id
----------+------------+--------------
24657661 | 3561713314 | 101
24657662 | 3561713316 | 101
24657694 | 3573505782 | 101
24657695 | 3573506323 | 101
(4 rows)
gitlabhq_dblab=# select id, partition_id, created_at from ci_builds where id in ( select build_id from ci_builds_runner_session where partition_id = 101);
id | partition_id | created_at
------------+--------------+----------------------------
3561713314 | 101 | 2023-01-05 19:19:43.760429
3561713316 | 101 | 2023-01-05 19:19:43.775379
3573505782 | 101 | 2023-01-09 14:10:18.003423
3573506323 | 101 | 2023-01-09 14:10:21.467885
(4 rows)
gitlabhq_dblab=# select count(*) from ci_builds_runner_session inner join ci_builds on ci_builds.id = ci_builds_runner_session.build_id where ci_builds.partition_id <> ci_builds_runner_session.partition_id;
count
-------
0
(1 row)
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #382033 (closed)
Edited by Marius Bobin