#24311: Foreign key constraint error when syncing unmigrated models that relate 
to
migrated models
---------------------------------+--------------------------------------
     Reporter:  collinanderson   |                    Owner:  nobody
         Type:  Bug              |                   Status:  closed
    Component:  Migrations       |                  Version:  1.8alpha1
     Severity:  Release blocker  |               Resolution:  wontfix
     Keywords:                   |             Triage Stage:  Unreviewed
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+--------------------------------------

Comment (by MarkusH):

 Hint: the constraints to e.g. `auth_group` are created if `auth` has been
 migrated before:

 {{{#!bash
 $ python manage.py migrate auth
 $ python manage.py migrate
 $ echo "SHOW CREATE TABLE app_myuser_groups;" | mysql -u django -p django
 Enter password:
 Table   Create Table
 app_myuser_groups       CREATE TABLE `app_myuser_groups` (\n  `id` int(11)
 NOT NULL AUTO_INCREMENT,\n  `myuser_id` int(11) NOT NULL,\n  `group_id`
 int(11) NOT NULL,\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `myuser_id`
 (`myuser_id`,`group_id`),\n  KEY `app_myuser_groups_f1d9e869`
 (`myuser_id`),\n  KEY `app_myuser_groups_5f412f9a` (`group_id`),\n
 CONSTRAINT `group_id_refs_id_58abbaa5` FOREIGN KEY (`group_id`) REFERENCES
 `auth_group` (`id`),\n  CONSTRAINT `myuser_id_refs_id_08272aba` FOREIGN
 KEY (`myuser_id`) REFERENCES `app_myuser` (`id`)\n) ENGINE=InnoDB DEFAULT
 CHARSET=utf8
 }}}

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

Reply via email to