#25833: Non-atomic migrations
-----------------------------+--------------------------------------
     Reporter:  Pankrat      |                    Owner:  nobody
         Type:  New feature  |                   Status:  new
    Component:  Migrations   |                  Version:  master
     Severity:  Normal       |               Resolution:
     Keywords:               |             Triage Stage:  Unreviewed
    Has patch:  1            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  0
Easy pickings:  0            |                    UI/UX:  0
-----------------------------+--------------------------------------
Changes (by Pankrat):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Old description:

> 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
>
> I'll open a pull request for this new feature in a bit.

New description:

 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.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/25833#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.b3d4f4263a9c102166ffc228cc49ead6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to