./manage.py migrate app -n 1./manage.py migrate app -n 1Hi 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.
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.
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.
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.
The third issue is an intriguing idea. It was presented as "keep more than one
state of migration history in the database", but I think that a general
multiple-migration-history mechanism is neither required nor sufficient for the
user's goal. What he wanted was:
3) Separate "destructive" migrations from "non-destructive" -- if I got it
right, "destructive" in the sense that "the old code can no longer work with
the database after the migration". So, adding a nullable column, or a new
table, would generally be non-destructive. If you have several servers running
on the same database, with this separation you can do a rolling upgrade --
first make non-destructive changes, then upgrade the servers one by one, and
only when they all have the new code, do the destructive migration.
I'll try to clarify what I've meant.
A destructive operation is any operation which would break backward compatibility with a previous version of the application.
I proposed implementing the ability to have multiple south migration sequences mapped to multiple south tables in the database.
And having the ability to indicate to which migration sequence I'm adding the migration via the cli
for example two migration sequences :
1. Additive: new tables, columns
2. Destructive: delete tables, columns , migrate data to new scheme.
This feature could also be of value when migrating a model between diango apps.
Erik.
Adding a not null column can be a breaking operation
--
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-develop...@googlegroups.com.
To post to this group, send email to django-d...@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/1af61e31-7a77-45e4-9a99-fd7e990fa28f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.