We are fairly new to Django. We we have an app and a model. We'd like to add an 'Category' object to our model. We did that, and then ran 'python manage.py makemigrations'.

We then deploy our code to a server running the older code, and run 'python manage.py migrate'. This throws 2 pages of exceptions, finishing with 'django.db.utils.ProgrammingError: (1146, "Table 'reporting.contact\_category' doesn't exist")'

This seems to be looking at our models.py. If we comment out Category from our model, and all references to it, the migration succeeds.

I thought that the point of migrations is to make the database match what the model expects, but this seems to require that the model match the database before the migration.

We clearly are doing something wrong, but what?