When migrations are created in Django 1.7, the fixtures are ignored. This
is a perfectly fine decision, but many users (such as myself) still need
fixture-like functionality. That functionality is provided by RunPython or
RunSQL within a migration. While the release notes correctly indicate that
modifying/creating a migration can replace initial_data, they could be a
little clearer, noting RunPython or RunSQL. For example:
"initial_data fixtures are no longer loaded for apps with migrations; if
you want to load initial data for an app, we suggest you do it in a
migration."
... could become
"initial_data fixtures are no longer loaded for apps with migrations; if
you want to load initial data for an app, we suggest you create a
migration for you application and define a RunPython or RunSQL command in
the operations section of the migration."
That could be immensely helpful for pointing users in the right direction,
especially if they are eager to quickly get django 1.7 up and running...
whilst maintaining fixture-like functionality.
--
Ticket URL: <https://code.djangoproject.com/ticket/23512>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: info+coding@… (added)
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/23512#comment:1>
* type: Uncategorized => Cleanup/optimization
* easy: 0 => 1
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/23512#comment:2>
Comment (by timgraham):
Should also be changed in the 1.7 release notes as described in #23513.
--
Ticket URL: <https://code.djangoproject.com/ticket/23512#comment:3>
* status: new => assigned
* owner: nobody => olasitarska
--
Ticket URL: <https://code.djangoproject.com/ticket/23512#comment:4>
* has_patch: 0 => 1
Comment:
PR https://github.com/django/django/pull/3250
--
Ticket URL: <https://code.djangoproject.com/ticket/23512#comment:5>
* stage: Accepted => Ready for checkin
Comment:
Thank you Ola. Looks good to me.
--
Ticket URL: <https://code.djangoproject.com/ticket/23512#comment:6>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"21819e6dbf422fe3ebe23cc006c0ef7bfc5c73de"]:
{{{
#!CommitTicketReference repository=""
revision="21819e6dbf422fe3ebe23cc006c0ef7bfc5c73de"
Fixed #23512 -- Made migration docs about initial_data clearer
Thanks @abhillman and @Markush2010 for submitting the ticket.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23512#comment:7>
Comment (by Baptiste Mispelon <bmispelon@…>):
In [changeset:"99c2e40384ff74755145e05bd12f081316941e81"]:
{{{
#!CommitTicketReference repository=""
revision="99c2e40384ff74755145e05bd12f081316941e81"
[1.7.x] Fixed #23512 -- Made migration docs about initial_data clearer
Thanks @abhillman and @Markush2010 for submitting the ticket.
Backport of 21819e6dbf422fe3ebe23cc006c0ef7bfc5c73de from master.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23512#comment:8>