Opened 9 years ago

Last modified 9 years ago

#25833 closed New feature

Non-atomic migrations — at Version 1

Reported by: Ludwig Hähne Owned by: nobody
Component: Migrations Version: dev
Severity: Normal Keywords:
Cc: Shai Berger Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ludwig Hähne)

Database transactions are always wrapped in transactions (on DBs that support transactional DDL like Postgres). Generally this is a good idea.

However, one can't do batched updates in data migrations which is essential for performing changes on big tables on a live DB:

http://pankrat.github.io/2015/django-migrations-without-downtimes/

It's also not possible to create indexes concurrently on Postgres from inside a transaction.

Therefore, I'd like to have support for non-atomic migrations in Django because it's pretty messy to work around not having proper support for that:

http://stackoverflow.com/questions/31247810/commit-manually-in-django-data-migration

I propose exempting specific migrations from being wrapped in a transaction by setting atomic = False on the migration:

https://github.com/django/django/compare/master...Ableton:non-atomic-migrations

This was already discussed on the Django developers mailing list:

https://groups.google.com/forum/#!topic/django-developers/aAYiyAqTlUc

I'll open a pull request for this new feature in a bit.

Change History (1)

comment:1 by Ludwig Hähne, 9 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top