Loading
Add organization_id to bulk_import_export_batches
What does this MR do and why?
Part 1 of 2: Add organization_id column to bulk_import_export_batches
Adds organization_id to bulk_import_export_batches (step 2/3 of #603592 (closed); parent table done in #600457 (closed) via !241088 (merged) / !241089 (merged)). Schema-only, no data changes:
- Adds nullable
organization_id(bigint) - Adds a concurrent index on it (
idx_bulk_import_export_batches_on_organization_id) - Adds a FK to
organizations(on_delete: :cascade,NOT VALID; validation comes in the finalize phase, #603593 (closed)) - Adds
desired_sharding_key_migration_job_nametodb/docs/bulk_import_export_batches.ymland allowlists the table inspec/lib/gitlab/organizations/sharding_key_spec.rb
The backfill (trigger + BBM) follows in Part 2.
Note for reviewers: this is a stacked MR. Please review Part 2 as well: !243559 (closed).
Table size:
table_size: smallper db/docs, ~808K rows on GitLab.com — well under the 50GB FK-addition limit.
Migration details
db/migrate/20260702120000_add_organization_id_to_bulk_import_export_batches.rb
db/post_migrate/20260702120001_add_concurrent_index_organization_id_on_bulk_import_export_batches.rb
db/post_migrate/20260702120002_add_foreign_key_constraint_on_bulk_import_export_batches_organization_id.rbMR acceptance checklist
- Migrations tested up and down locally
- Database review
References
- Issue #603592 (closed) (parent #600457 (closed) done; finalize is #603593 (closed) and out of scope here)
- Mirrors merged !241088 (merged) for the parent table
bulk_import_exports
Edited by Rez