Reputation: 69
So i'm following the Tango with Django guide, specifically part 7.3.2. of the tutorial. After I ran the command python3 manage.py makemigrations rango
, it won't let me re-populate the database using the populate
script. Instead I got the error: django.db.utils.OperationalError: no such column: rango_category.slug
.
Then, I tried to revert things back to normal by deleting all the slug
code (so before 7.3 of the guide). I made a migration after doing so, but then because the prior migration which added the slug category was never deleted, I can't use the migrate
command to revert my changes because it throws an error when it tries to migrate
using the old Added category slug
migration. Even when I specifically point to the newest migration, it still gives me an error for the old one.
Then, in an effort to fix things, I used a bunch of different migrate
and makemigrations
commands, including --empty, --fake, squashmigrations
etc and now my migrations look unrecognizable. Is there a way to just delete all these existing migrations and just start from a completely clean slate?
This is what migrate --list
looks like now, for reference:
admin
[ ] 0001_initial
auth
[ ] 0001_initial
rango
[ ] 0001_squashed_0003_category_slug (3 squashed migrations)
[ ] 0001_squashed_0005_auto_20150328_0917 (5 squashed migrations)
contenttypes
[ ] 0001_initial
sessions
[ ] 0001_initial
Upvotes: 1
Views: 407
Reputation: 584
You don't need to delete the migrations folder, only the migrations files, but leave __init__.py there.
Upvotes: 1
Reputation: 20339
For a clean start.
migrations
folder inside rango
Upvotes: 1