Question

I converted an existing Django app to use South. I needed to add an ID column to one of the models, so I added id = models.AutoField(primary_key=True) to the model. But when I run:

python manage.py schemamigration myapp --auto

I get:

Nothing seems to have changed.

And when I subsequently try to migrate the app, it says there's nothing to migrate. So I went into psql and inserted the column directly with SQL. But how do I sync my model with the database at this point?

python manage.py syncdb

says that I need to migrate my app, but nothing happens when I python manage.py migrate myapp.

Was it helpful?

Solution

Django implicitly creates the id column, with this exact definition:

id = models.AutoField(primary_key=True)

So, in fact, nothing has changed!

The message you get when you do syncdb is just a reminder that your app uses migrations; it does not mean that there are currently unapplied migrations.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top