Skip to content

Draft: Swap ci_builds primary key

Max Orefice requested to merge morefice/swap-ci-build-primary-key into master

Ref: #382033 (closed)

  • Redefine all FK referencing ci_builds to include partition_id

What does this MR do and why?

This MR prepares Ci::Build for partitioning.

It makes sure the primary key includes the partition key.

Database changes

Indexes:
-     "ci_builds_pkey" PRIMARY KEY, btree (id)
+     "ci_builds_pkey" PRIMARY KEY, btree (id, partition_id)

Why are we doing this?

This work is mandatory in order to partition ci_builds as explained in #382033 (closed).

This is the same technique we used to redefine ci_builds_metadata PK in !97926 (merged), we are now using swap_primary_key helper.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Max Orefice

Merge request reports