Opened 5 years ago

Closed 5 years ago

#31176 closed Cleanup/optimization (duplicate)

"manage.py migrate" should wrap all migrations into a single transaction.

Reported by: Andrew Badr Owned by: nobody
Component: Migrations Version: 3.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently, manage.py migrate executes each migration in turn within its own transaction. This can break things in the following situation:

  1. Attempt to deploy a change that includes multiple unapplied migrations
  2. Some of the migrations get applied, then one fails (like a check constraint)
  3. Code deploy is rolled back, but database is left in an inconsistent state.

To avoid this problem, if the user is attempting to apply a set of migrations all at once, they should all be wrapped into a single transaction.

Change History (1)

comment:1 by Mariusz Felisiak, 5 years ago

Component: Database layer (models, ORM)Migrations
Resolution: duplicate
Status: newclosed
Summary: `manage.py migrate` should wrap all migrations into a single transaction"manage.py migrate" should wrap all migrations into a single transaction.

Duplicate of #24535.

Note: See TracTickets for help on using tickets.
Back to Top