Django migrations : relation already exists

前端 未结 6 919
南笙
南笙 2021-02-06 18:46

I have trouble with django model migrations. I have some models in my app, and I already have some data inside. When I added some models in my application, and I run mak

6条回答
  •  粉色の甜心
    2021-02-06 19:15

    The main problem is the existing tables that are disabling the migration of the new tables, so the solution is straight-forward:

    ** Try to add managed = False to the existing dB so it won't be detected by migrate

    ** Redo it for all existing old tables :

    class Meta:
        managed=False
    

    It sometimes gets boring when we have a lot of tables in the same application but it works perfectly!

提交回复
热议问题