Bob,
You can control the order in which migrations run.
For South, see "depends_on" and "needed_by":
- http://south.readthedocs.org/en/latest/dependencies.html
For Django 1.7 migrations, see "dependencies":
- https://docs.djangoproject.com/en/dev/topics/migrations/#dependencies
You can control the order in which migrations run.
For South, see "depends_on" and "needed_by":
- http://south.readthedocs.org/en/latest/dependencies.html
For Django 1.7 migrations, see "dependencies":
- https://docs.djangoproject.com/en/dev/topics/migrations/#dependencies
--Fred
Fred Stluka -- mailto:fred@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
On 9/26/14 9:58 AM, bobhaugen wrote:Fred Stluka -- mailto:fred@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
Andrew, thanks for the article, and the more-to-come.--
When you get to data migrations, you might want to cover a problem I ran into with them: when I had a data migration in the middle of a sequence of other migrations, and then later wanted to set up a new environment, which meant running all of the migrations in sequence from the beginning, the data migration was now running in the latest models.py code, not the code in which it initially worked. So it did not work any more.
In particular, the data migration was a precursor to another schema migration were a field would be removed. The data migration was to move the existing data in the field-to-be-removed to a different field. So when the data migration ran in the longer sequence, the field it was trying to move data from was now gone from the code.
I suspect there are a lot of other ways to shoot yourself in the foot with data migrations, so we have stopped using them and just use our own data migration scripts outside of the sequence of schema migrations.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9f4e1b6a-4051-478d-9a09-43318266ed7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment