I made a spelling error in my model and now one of my columns is misspelled. I'd like to drop all tables in the database, fix the error in the model.py, and recreate the database with the correct spelling in model.
I've tried to use the suggestions in the this article but the table still exists after I follow the commands outlined there.
Anyone have a quick way to do this?
Like most relational database systems, SQLite does not use the DROP DATABASE command to drop a database and there is no special syntax or steps to drop the database in SQLite. You just have to delete the file manually. Here filename is always unique i.e. database name is always unique and it is case-sensitive.
db.sqlite3
) in your django project folder (or wherever you placed it)__init__.py
file from migration
folder in all django apps (eg: rm */migrations/0*.py
)models.py
).python manage.py makemigrations
or python3 manage.py makemigrations
python manage.py migrate
.That's all.
If your changes to the models are not detected by makemigrations
command, please check this answer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With