Friday, September 26, 2014

Re: Upgrading Django (to 1.7)

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