#23988: Fixtures should be loaded after migrations
----------------------------+--------------------
     Reporter:  yuriiz      |      Owner:  nobody
         Type:  Bug         |     Status:  new
    Component:  Migrations  |    Version:  1.7
     Severity:  Normal      |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0           |      UI/UX:  0
----------------------------+--------------------
 It is currently not possible to add data for apps that have migrations in
 fixtures/initial_data.json because migrate command loads fixtures after
 syncdb but before migrations i.e. when required tables do not exist yet.
 For example if one adds data for flatpages app in fixtures/initial_data
 like this:

 {{{
 {
     "fields": {
         "registration_required": false,
         "title": "foo",
         "url": "/url/",
         "template_name": "",
         "sites": [1],
         "content": "bar",
         "enable_comments": false
     },
     "model": "flatpages.flatpage",
     "pk": 1
 }
 }}}
  running "manage.py migrate" on new DB will result in:

 {{{
     return Database.Cursor.execute(self, query, params)
 django.db.utils.OperationalError: Problem installing fixture
 '/home/user/project/fixtures/initial_data.json': Could not load
 flatpages.FlatPage(pk=1): no such table: django_flatpage
 }}}
 This breaks DB creation on "manage.py test" as well.
 Correct behaviour would be to install initial_data.json AFTER tables for
 apps with migrations are created as well.

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

Reply via email to