Add NOT NULL constraint and ON DELETE CASCADE on epics.issue_id column

Before running the very first work items backfilling migration, i.e. Backfill epic attributes directly into issues t... (&12740 - closed) we need to ensure data integrity at the DB level.

By adding a NOT NULL constraint on epics.issue_id column, without validating it initially, we would prevent any new epic records being created without setting the epics.issue_id, i.e. without a corresponding epic work item being created. This will help ensure that every legacy Epic has a corresponding work item at DB level.

Also as part of adding the NOT NULL constraint we need to make sure we change the epics.issue_id FK constraint from ON DELETE SET NULL to ON DELETE CASCADE.

After running the epic work item backfilling and finalising the migration, we will have a separate migration to validate the NOT NULL constraint on epics.issue_id column.

TASKS
  • Update epics.issue_id FK to ON DELETE CASCADE !143844 (merged)
  • Add not null constraint to epics.issue_id !153157 (merged)
  • [ ] Schedule asynchronous validation check
  • [ ] Validate the NOT NULL constraint

last 2 tasks are tracked in Validate the NOT NULL constraint on the `epics.... (#451434 - closed) • Alexandru Croitor • 17.1

Edited by Alexandru Croitor