Saturday, September 27, 2014

Re: Upgrading Django (to 1.7)

Hi Bob,
Thank you!

I spend a lot of Part II talking about schema and data migrations in both South and native Django 1.7 migrations. When building data migrations, you should be using historical models. In Django 1.7, you can request these models directly from the app registry built on the fly by the migration system and passed to the methods specified in the `RunPython` operation. This avoids using the models as they exist in the `models.py` file. This is similar to South's requirement you use the `orm` variable to interact with models, as Fred mentions.

If you would like more depth on the topic, then Part II is for you. If you would like to explore the topic before Wednesday, this is material available in the video. The code in the slides and github repo may be quite helpful as well.

afrg.co/updj17

Data migrations and schema migrations should play very well with each other. As I mentioned to Sabine, the only instance I had any difficulty was when I squashed migrations. As I had been alternating systematically between schema migrations and data migrations, the automatic squash tool was unhelpful. Thankfully, as the migration files are now easy to edit, I had absolutely no issue modifying the squash migration file myself.

Unfortunately, I do not go into detail about this in the article. Hopefully, the number of times we directly modify the migration files will allow people to figure this out for themselves. If that is not the case, and enough people ask, I will happily write a short article about the process.

If you have any questions about data migrations after reading Part II, please ask them here!

Andrew

--
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/27F0C6E5-1DEC-4C79-A3AD-59005A801B1A%40andrewsforge.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment