Tim S.
Tim S.

Reputation: 2257

No model tables are created for a Django migration

I have searched other articles (like this one) for a solution, but nothing has helped so far...

I realized while working on my project that I needed to alter the model, changing a primary key to an AutoField rather than use a custom field. I knew this would cause a lot of issues since I have quite a few ForeignKey fields, so I wanted to drop all of my tables, clear out the migrations, and just let the migrations re-generate all of the the tables. The problem is that even though I dropped all of the tables (and eventually the whole database, due to the django_migrations table and any other latent data), cleared out all of the project/app/migrations directories, when I run manage.py makemigrations/manage.py migrate, it only creates the built-in tables (the auth_* and django_* tables) and none of my model tables get recreated.

Where else do I need to clean up in order to be able to start over with a fresh database model? I thought that clearing out the migrations directories would be sufficient, but there's something else I'm missing.

Thanks.

Upvotes: 0

Views: 876

Answers (1)

Alasdair
Alasdair

Reputation: 308789

If you have deleted the migrations folder for an app, you have to specify the app name to create the initial migrations:

./manage.py makemigrations myapp

Upvotes: 2

Related Questions