wiki:FAQ

Version 10 (modified by andrew, 4 years ago) (diff)

--

Frequently Asked Questions

If you have a question you think needs to go on here, then get in touch.

Why does my migration with both column changes and data changes fail?

You can't edit the columns and the data in them in the same transaction, and since all migrations are wrapped in transactions your database will complain. See Migration Structure: Transactions for more, and an example of how to start a new transaction.

My data migration involving ContentType is failing

This is probably because you're using ContentType, not orm['contenttypes.ContentType'] - the latter is the frozen model, and is the one your frozen models will be reconstructed using. You'll need to use it for comparisons to work correctly.

Why does South keep claiming my migration doesn't exist, when it does?

This is probably because you have an ImportError? in your migration; South can't distinguish between this and a missing migration. See #29.

Passing a field with unique=False to alter_column doesn't remove that column's UNIQUE constraint.

No, it doesn't, you need to use delete_unique instead, like so:

db.delete_unique("tablename", ["columnname"])

Note that in MySQL this will also drop an index you have on the column.

I'm using PostgreSQL, and migrations just hang indefinitely

This is actually PostgreSQL hanging on the schema-altering statement - it usually means it's waiting for other connections. You can "fix" it by closing your other apps with connections to the database (e.g. ./manage.py shell), or by restarting the database to accomplish the same thing.

South won't see my apps!

This is actually usually because Django can't see them either. To see if Django knows about them, do:

./manage.py shell
from django.db import models
models.get_app("myappname")

If that works, then it may well be a South bug; if it errors, you have an issue with your Django setup.