python - Django incorrectly expecting id column -


i'm working existing sql database in django. these tables reason never given primary keys i'm going through , assigning them ones. in 1 of these models, changed existing unique index primary index using primary_key = true. ran ./manage.py makemigrations (app_name); ./manage.py migrate. came across error: (1091, "can't drop 'id'; check column/key exists"). seems though django assumed there id field model when there wasn't because able use phpmyadmin make id field, , when re-ran migration succeeded. while able fix problem doubt best way go it. correct way deal problem?

you fake migration including removing "id" field using --fake option when migrating, django thinks had deleted id field when never existed.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -