deleting files in django

what happens when we deleted all the migrations file in django?

About the same thing as if you delete any group of files within your project - you’ve probably broken it.

Fortunately, in the case of migrations, it may not be fatal - it really depends upon whether or not you have any existing instances of your project running that may need those migrations to be brought up-to-date.

First option would be to back out those file deletions, hopefully by checking out your most recent version that still has your migration files from your version control system.

If there’s no such version available, you can try to fix things manually.

At a minimum you want to empty, but not delete, your django_migrations table in your database. Then, if your models match your current database structure, you can then do a makemigrations \ migrate --fake.

However, if you’re still early in your development phase, it may be easier to just delete your database and recreate it.

If you’ve got other instances running that you also need to fix, you may have a bit of work ahead of you to get it all straightened out.