Add project_id column to packages_dependencies table
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:
- Deletes the existing
UNIQUE
index onname, version_pattern
. - Adds the temporary
UNIQUE
index onname, version_pattern WHERE project_id IS NULL
. - Adds the new
UNIQUE
index onname, 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