How to reset django migrations

Other topics

Resetting Django Migration: Deleting existing database and migrating as fresh

Drop/Delete your database If you are using SQLite for your database, just delete this file. If you are using MySQL/Postgres or any other database system, you will have to drop the database and then recreate a fresh database.

You will now need to delete all the migrations file except "init.py" file located inside the migrations folder under your app folder.

Usually the migrations folder is located at

/your_django_project/your_app/migrations

Now that you have deleted the database and the migrations file, just run the following commands as you would migrate the first time you setup django project.

python manage.py makemigrations
python manage.py migrate

Contributors

Topic Id: 9513

Example Ids: 29416

This site is not affiliated with any of the contributors.