#30269: AlterField in database_operations of SeparateDatabaseAndState migration
doesn't set NOT NULL constraint for PostgreSQL
----------------------------------+--------------------------------------
     Reporter:  Dmitrii Prihodco  |                    Owner:  nobody
         Type:  Bug               |                   Status:  closed
    Component:  Migrations        |                  Version:  2.1
     Severity:  Normal            |               Resolution:  invalid
     Keywords:                    |             Triage Stage:  Unreviewed
    Has patch:  0                 |      Needs documentation:  0
  Needs tests:  0                 |  Patch needs improvement:  0
Easy pickings:  0                 |                    UI/UX:  0
----------------------------------+--------------------------------------
Changes (by Simon Charette):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 All the operations operate on the difference between the implicit previous
 state and the one that applying the operation on it would generate and
 `SeparateDatabaseAndState` behaves the same way.

 What you are doing here by breaking the desired changes in two migrations
 by creating an asymmetry between the project state and the database state.
 When the second operation runs the state already has it's field altered by
 the previous `SeparateDatabaseAndState` and thus the migration framework
 considers your database operation as a noop.

 In summary this is working as designed and performing the second operation
 using `RunSQL` is the right approach if you want to effectively break this
 in two migrations. A preferred way of ensuring no downtime for such field
 alteration is usually to simply run such migrations once the code is
 deployed instead.

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

Reply via email to