Loading
Add organization_id column to bulk_import_exports
What does this MR do and why?
Part 1 of 2: Add organization_id column to bulk_import_exports
First step toward an organization_id sharding key. Schema-only, no data changes:
- Adds nullable
organization_id(bigint) - Adds a concurrent index on it
- Adds a FK to
organizations(on_delete: :cascade,NOT VALID; validation comes in a later phase)
The backfill follows in Part 2.
Note for reviewers: this is a stacked MR. Please review Part 2 as well: !241089 (merged).
Migration details
db/migrate/20260617101501_add_organization_id_to_bulk_import_exports.rb
db/post_migrate/20260617101502_add_concurrent_index_organization_id_on_bulk_import_exports.rb
db/post_migrate/20260617101503_add_foreign_key_constraint_on_bulk_import_exports_organization_id.rbMR acceptance checklist
- Migrations tested up and down locally
- Database review
References
- Issue #600457 (closed), epic &21584 (closed)
- Row counts (database-lab):
bulk_import_exports~7.6M,bulk_import_export_batches~808K. Too large for an inline backfill, so the work uses the BBM path across ~%19.2–%19.4. - Follows the sibling
bulk_import_trackersrollout.
Edited by Bojan Marjanovic