On Wednesday, September 24, 2014 8:24:28 AM UTC+9:30, Shai Berger wrote: > > Hi all, > > I gave a talk to a local user-group about the migrations in 1.7, and some > people in the audience raised things they would like to be able to do, and > are > not supported by the current framework; thought it would be nice to bring > them > here. > > Two issues were about handling migrations at the project level rather than > app > level: > > 1) Cross-app migrations. The act of moving a model from one app to another > should be a common-enough refactoring; especially for beginners, breaking > a > piece of an app out to a separate app is something a user is very likely > to > want. Current migrations, being app-oriented, make this possible, but a > little > awkward. >
I had a need to do something similar to this: basically adding an extra attribute to a contrib app (and the database column too). It is possible to write a custom migration operation that allows you to alter a model that is not part of the same app, but, yes, it's a pain in the proverbial. I guess the 'changing app of a model' is something that could appear. However, it's going to require having a db_table entry in Meta at the least, or migrations to rename the table. I guess you could replace the creation migration with one that renames the other one. > 2) Roll back project to point in history. This is requested by people who > want > to work on feature branches (or any separate branches, each with its own > migrations). It is a bit of a hard problem I've run int myself, and I > suspect > it requires some integration with source-control systems to be done right. > The > solution I recommended (and used) was to keep separate databases for > separate > branches, but that is quite cumbersome in a large project. > It's no different to what exists with south though, or any other migration system. The backwards migrations need to be done while the checked out version contains them. You could have a pre-update hook that examines if the changeset you are checking out is missing any migrations, and warn that reverse migrations may need to be run first. Matt. -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/dad40f8c-92b7-47d4-8fd0-5d06ecbab42f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.