Replace foreign keys to use the partitioned table
What does this MR do and why?
Related to #414396 (closed)
After partitioning ci_builds
we need to update all the tables that reference it to use the routing table instead. This adds the invalid FKs and schedule the async validation for them.
Next steps
- Synchronous validation: !122087 (merged)
- Finish adding the FKs between partitioned tables: !122097 (closed)
- Drop old FKs and rename the new ones: !122102 (closed)
How to set up and validate locally
-
./scripts/regenerate-schema
to run migrations in the test env -
RAILS_ENV=test bin/rails runner "Feature.enable(:database_async_foreign_key_validation)"
for the next step -
RAILS_ENV=test bin/rails gitlab:db:validate_async_constraints:all
to validate the constraints -
RAILS_ENV=test bin/rails db:migrate
to dump the schema changes -
NOT VALID
lines will be removed from thestructure.sql
file
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