Django column “name” of relation “django_content_type” does not exist

后端 未结 8 1828
忘了有多久
忘了有多久 2020-12-23 14:31

I keep getting the following error when doing a migration (python manage.py migrate):

django.db.utils.ProgrammingError: column \"name\" of relation \"django_         


        
8条回答
  •  悲&欢浪女
    2020-12-23 14:45

    I know that is an old question, but this might help some one. I was getting this error too. The problem was that content_types had a migration called 0002_remove_content_type_name that remove the column "name".
    After remove migration data from table and folder this steps works for me:

    ./manage.py makemigrations myappname
    ./manage.py migrate myappname
    ./manage.py migrate --fake contenttypes
    

    If you have sure that the rest of your db reflect your migration, you can use:

    ./manage.py migrate --fake
    

    See the result with:

    ./manage.py showmigrations
    

    After that, all your migrations should be marked and you should be fine

提交回复
热议问题