Skip to content

Add project_id column to packages_dependencies table

Dzmitry (Dima) Meshcharakou requested to merge 465276-add-project-id-column into master

What does this MR do and why?

The packages_dependencies table currently is shared for all packages. That needs to be changed in order to have a project_id sharding key.

This MR adds project_id column to packages_dependencies table and changes the uniqueness validation and UNIQUE database indexes to consider project_id column:

  1. Deletes the existing UNIQUE index on name, version_pattern.
  2. Adds the temporary UNIQUE index on name, version_pattern WHERE project_id IS NULL.
  3. Adds the new UNIQUE index on name, version_pattern, project_id WHERE project_id IS NOT NULL;

The project_id backfilling and setting it for new records will be added in the separate MRs.

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.

How to set up and validate locally

Run the migrations rails db:migrate:main

Related to #465276 (closed)

Edited by Dzmitry (Dima) Meshcharakou

Merge request reports

Loading