1

I am building a Django web application and I dropped the table django_migrations using psql command line and I want to recreate it.

  • 2
    `manage.py migrate --fake …` and `--fake-initial` might be helpful. [docs](https://docs.djangoproject.com/en/3.1/ref/django-admin/#cmdoption-migrate-fake) – Klaus D. Dec 27 '20 at 20:23
  • 1
    Thank you, I have used `python manage.py migrate --fake` and it worked and recreated the table. – ElFadily Mohamed Dec 27 '20 at 20:29

1 Answers1

1

To recreate django_migrations simply use

./manage.py migrate --fake

But please be careful with that as mentioned here:

If you break something, nobody can help you probably, because the migration system will not know the current state of the database more. Therefore do a backup, write notes, use a sandbox and work precisely.

Django migrate --fake and --fake-initial explained

Maciej M
  • 786
  • 6
  • 17