Skip to content

Redefine referenced FK ci_job_artifacts

Ref:

What does this MR do and why?

Similar approach we used for ci_builds in !121718 (merged).

This MR does 2 things:

  • Redefine our referenced FKs for ci_job_artifacts
  • Validate them async over the weekend during low traffic as ci_job_artifacts is a busy table

Why are we doing this?

Necessary step in order to partition ci_job_artifacts as each referenced FK must include the partition key, as explained in our documentation.

Testing locally

Feature.enable(:database_async_foreign_key_validation)
bundle exec rails db:migrate
bundle exec rails gitlab:db:validate_async_constraints:all

https://docs.gitlab.com/ee/development/database/add_foreign_key_to_existing_column.html#verify-the-foreign-keys-validated-asynchronously

Edited by Max Orefice

Merge request reports