On Fri, Oct 22, 2021 at 7:09 AM Ammon Quackenbush <aq...@chem.byu.edu> wrote:
> I think you are right. I did delete the initial migration. How do I > restore the initial migration? > > Can't you restore it from your git repo? If you're not running any sort of version control you've just hit the reason why doing so is important. If that is not an option then it can be tricky. If you have the luxury of backing up your existing data (e.g. using dumpdata), then you can wipe your entire database, run makemigrations, migrate and then re-import your data. This is the most straight-forward method, but depending on the size of your data may take a while. This would be my recommended way as it is the safest way to restore your migrations state. On a lesser extreme, and depending on the exact nature of your error and whether current tables are otherwise up to date wrt your models (if not you may run into issues), you can also reset or drop django_migrations table, remove migrations for apps with missing migration files, run makemigrations to re-create them (without any history) then migrate --fake to re-create and re-populate the django_migrations table which will not affect existing tables. HTH, David -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAE5VhgWNvOzjtdYxMo-GX%2B0famY3TQn08yv_BAXpXm1Xc3%3DoyA%40mail.gmail.com.