#30741: sqlmigrate doesn't show a drop constraint SQL when previous create
constrain operation wasn't perform.
-------------------------------------+-------------------------------------
     Reporter:  Scott Stafford       |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Migrations           |                  Version:  master
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  db_constraint,       |             Triage Stage:
  migrations                         |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by felixxm):

 * status:  new => closed
 * type:  Uncategorized => Bug
 * version:  2.2 => master
 * resolution:   => invalid


Comment:

 Thanks for this report, however IMO everything works properly.

 Removing constraints is based on introspection, hence SQL generated by the
 second migration is empty because you didn't run the first migration that
 creates constraint and in a consequence the second one wasn't able to
 introspect a non-existent constraint.

 0002 - SQL (before performing the first migration)
 {{{
 BEGIN;
 --
 -- Alter field parent on child
 --
 COMMIT;
 }}}

 0002 - SQL (after performing the first migration)
 {{{
 BEGIN;
 --
 -- Alter field parent on child
 --
 SET CONSTRAINTS
 "test_30741_child_parent_id_f98c7dab_fk_test_30741_parent_id" IMMEDIATE;
 ALTER TABLE "test_30741_child" DROP CONSTRAINT
 "test_30741_child_parent_id_f98c7dab_fk_test_30741_parent_id";
 COMMIT;
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30741#comment:2>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.3cddbf2d709bf4e8195b06167f3e6ccd%40djangoproject.com.

Reply via email to