[Django] #23077: Django 1.7 rc1 flush command loads initial data regardless of the migrations

15 views
Skip to first unread message

Django

unread,
Jul 22, 2014, 11:04:47 AM7/22/14
to django-...@googlegroups.com
#23077: Django 1.7 rc1 flush command loads initial data regardless of the
migrations
----------------------------+----------------------
Reporter: linovia | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7-rc-1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+----------------------
This is following ticket #23031

We have an issue with test runner that crashes on application that has
both initial_data and migrations.
The reason is the database is flushed before the migration however, flush
command will try to load initial_data anyway. This will crash the test
runner.
Following the documentation, initial_data is deprecated, not yet forbidden
at all.

--
Ticket URL: <https://code.djangoproject.com/ticket/23077>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 22, 2014, 1:14:15 PM7/22/14
to django-...@googlegroups.com
#23077: Django 1.7 rc1 flush command loads initial data regardless of the
migrations
---------------------------------+------------------------------------

Reporter: linovia | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7-rc-1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by timo):

* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* severity: Normal => Release blocker
* needs_tests: => 0
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/23077#comment:1>

Django

unread,
Jul 22, 2014, 1:47:42 PM7/22/14
to django-...@googlegroups.com
#23077: Django 1.7 rc1 flush command loads initial data regardless of the
migrations
---------------------------------+------------------------------------

Reporter: linovia | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7-rc-1
Severity: Release blocker | 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 merb):

https://docs.djangoproject.com/en/dev/releases/1.7/#schema-migrations
It's wrong in the docs. If you use both it won't work.

--
Ticket URL: <https://code.djangoproject.com/ticket/23077#comment:2>

Django

unread,
Jul 24, 2014, 9:02:29 AM7/24/14
to django-...@googlegroups.com
#23077: Django 1.7 rc1 flush command loads initial data regardless of the
migrations
---------------------------------+------------------------------------

Reporter: linovia | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7-rc-1
Severity: Release blocker | 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 linovia):

Doesn't the patch prevents any load data for migrated application ?
I mean, it looks like Django wouldn't be able to use loaddata for any
migrated application which I is not something we want, do we ?
All I can see in the release notes is that initial_data shouldn't be
possible for migrated apps.

--
Ticket URL: <https://code.djangoproject.com/ticket/23077#comment:3>

Django

unread,
Jul 24, 2014, 8:33:50 PM7/24/14
to django-...@googlegroups.com
#23077: Django 1.7 rc1 flush command loads initial data regardless of the
migrations
---------------------------------+------------------------------------

Reporter: linovia | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7-rc-1
Severity: Release blocker | 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 timo):

I agree with @linovia. I looked at it briefly and I think we could
probably pass the `test_database` flag from migrate to `loaddata` (via
`flush`) and check that before skipping initial data for apps with
migrations.

--
Ticket URL: <https://code.djangoproject.com/ticket/23077#comment:4>

Django

unread,
Jul 25, 2014, 8:51:07 AM7/25/14
to django-...@googlegroups.com
#23077: Django 1.7 rc1 flush command loads initial data regardless of the
migrations
---------------------------------+------------------------------------

Reporter: linovia | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7-rc-1
Severity: Release blocker | 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 merb):

ouch i've just seen some easier way maybe.

check that patch...

https://code.djangoproject.com/attachment/ticket/23077/new-23077.diff

If totally overseen the load_initial_data flag

--
Ticket URL: <https://code.djangoproject.com/ticket/23077#comment:5>

Django

unread,
Jul 25, 2014, 8:58:11 AM7/25/14
to django-...@googlegroups.com
#23077: Django 1.7 rc1 flush command loads initial data regardless of the
migrations
---------------------------------+------------------------------------

Reporter: linovia | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7-rc-1
Severity: Release blocker | 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 merb):

if this is the desired behavior i would write a test, that tests the test
runner.

--
Ticket URL: <https://code.djangoproject.com/ticket/23077#comment:6>

Django

unread,
Jul 25, 2014, 9:01:12 AM7/25/14
to django-...@googlegroups.com
#23077: Django 1.7 rc1 flush command loads initial data regardless of the
migrations
---------------------------------+------------------------------------

Reporter: linovia | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7-rc-1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by timo):

* cc: timo (added)
* has_patch: 0 => 1
* needs_tests: 0 => 1


Comment:

Looks good to me.

--
Ticket URL: <https://code.djangoproject.com/ticket/23077#comment:7>

Django

unread,
Jul 25, 2014, 9:03:33 AM7/25/14
to django-...@googlegroups.com
#23077: Django 1.7 rc1 flush command loads initial data regardless of the
migrations
---------------------------------+------------------------------------

Reporter: linovia | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7-rc-1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by timo):

It may be easier/simpler to keep the test localized to the migrate command
instead of testing the behavior indirectly through the test runner.

--
Ticket URL: <https://code.djangoproject.com/ticket/23077#comment:8>

Django

unread,
Jul 25, 2014, 11:58:07 AM7/25/14
to django-...@googlegroups.com
#23077: Django 1.7 rc1 flush command loads initial data regardless of the
migrations
---------------------------------+----------------------------------------
Reporter: linovia | Owner: andrewgodwin
Type: Bug | Status: assigned
Component: Migrations | Version: 1.7-rc-1

Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+----------------------------------------
Changes (by andrewgodwin):

* status: new => assigned
* owner: nobody => andrewgodwin


Comment:

That patch will disable initial data loading for _all_ apps - it should be
disabled for just the ones with migrations. I'll modify flush to only load
apps mentioned in loader.unmigrated_apps.

--
Ticket URL: <https://code.djangoproject.com/ticket/23077#comment:9>

Django

unread,
Jul 25, 2014, 12:09:44 PM7/25/14
to django-...@googlegroups.com
#23077: Django 1.7 rc1 flush command loads initial data regardless of the
migrations
---------------------------------+----------------------------------------
Reporter: linovia | Owner: andrewgodwin
Type: Bug | Status: assigned
Component: Migrations | Version: 1.7-rc-1

Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+----------------------------------------

Comment (by andrewgodwin):

After actually looking into this, there is no way to prevent people
mentioning models that are migrated in fixtures in unmigrated apps (Django
doesn't segregate models during fixture loading), so I'm going to say this
is still a documentation issue and that you should just delete the
initial_data fixtures from your migrated apps.

Additionally, I'm going to start initial_data on the deprecation path, so
if you run with pending deprecation warnings turned on you'll see errors
(and you'll definitely see them in 1.8).

--
Ticket URL: <https://code.djangoproject.com/ticket/23077#comment:10>

Django

unread,
Jul 25, 2014, 12:11:45 PM7/25/14
to django-...@googlegroups.com
#23077: Django 1.7 rc1 flush command loads initial data regardless of the
migrations
---------------------------------+----------------------------------------
Reporter: linovia | Owner: andrewgodwin
Type: Bug | Status: closed
Component: Migrations | Version: 1.7-rc-1
Severity: Release blocker | Resolution: invalid

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+----------------------------------------
Changes (by andrewgodwin):

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


--
Ticket URL: <https://code.djangoproject.com/ticket/23077#comment:11>

Django

unread,
Jul 25, 2014, 12:11:44 PM7/25/14
to django-...@googlegroups.com
#23077: Django 1.7 rc1 flush command loads initial data regardless of the
migrations
---------------------------------+----------------------------------------
Reporter: linovia | Owner: andrewgodwin
Type: Bug | Status: closed
Component: Migrations | Version: 1.7-rc-1

Severity: Release blocker | Resolution: invalid
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+----------------------------------------

Comment (by Andrew Godwin <andrew@…>):

In [changeset:"2bacc9f3b70e45b172675452b7dd32900fbb8a8b"]:
{{{
#!CommitTicketReference repository=""
revision="2bacc9f3b70e45b172675452b7dd32900fbb8a8b"
[1.7.x] Mark initial_data as deprecated separately from syncdb. Refs
#23077.

Conflicts:
docs/internals/deprecation.txt
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23077#comment:12>

Reply all
Reply to author
Forward
0 new messages