#25492: warn about migrations mixing schema- and data- changing operations
--------------------------------------+------------------------------------
     Reporter:  Joey Wilhelm          |                    Owner:  nobody
         Type:  New feature           |                   Status:  new
    Component:  Core (System checks)  |                  Version:  master
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------

Comment (by Simon Charette):

 I just wanted to mention that wrapping your migration operations with `SET
 CONSTRAINTS ALL IMMEDIATE` solves the `pending trigger events` message.

 {{{#!python
 operations = [
     migrations.RunSQL('SET CONSTRAINTS ALL IMMEDIATE', 'SET CONSTRAINTS
 ALL DEFERRED'),
     migrations.AlterField(
         model_name='charity',
         name='name_legal',
         field=models.CharField(max_length=255, default='',
 verbose_name='legal name'),
         preserve_default=False,
     ),
     migrations.RunSQL('SET CONSTRAINTS ALL DEFERRED', 'SET CONSTRAINTS ALL
 IMMEDIATE'),
 ]
 }}}

 Maybe this is something that could be done automatically by Django in
 `AlterField` when it knows it has to perform both a data and structural
 update?

--
Ticket URL: <https://code.djangoproject.com/ticket/25492#comment:7>
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/069.ab51b9768c9000b270340c2463a9a553%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to