Any idea why I would be getting this error when I try to migrate?
django.db.utils.ProgrammingError: relation "django_content_type"
I am using using Django 1.8 & PostgreSql
Any idea why I would be getting this error when I try to migrate?
django.db.utils.ProgrammingError: relation "django_content_type"
I am using using Django 1.8 & PostgreSql
You're going to need to use the --fake-initial
option when you migrate; it used to be implicit, but has now been made explicit:
https://docs.djangoproject.com/en/1.8/ref/django-admin/#django-admin-option---fake-initial
To quote:
This option is intended for use when first running migrations against a database that preexisted the use of migrations.
Good luck!
django.db.utils.ProgrammingError: column "name" of relation "django_content_type" does not exist
. Any ideas? Is it simply a matter of manually creating it? –
Employ This worked for me:
./manage.py migrate auth --fake-initial (this throws an error but ignore it)
./manage.py migrate --fake-initial
I, like many, don't really understand the problem. I was able to devise a solution that worked for me.
./manage.py migrate auth
./manage.py migrate
./manage.py migrate
.Good luck!
@Josh's solution worked for me with the following changes. Prior to step 1, I re-added the missing column:
ALTER TABLE django_content_type ADD COLUMN name character varying(50) NOT NULL DEFAULT 'run migrate.py';
Running python manage.py migrate auth
removes this column, presumabley making one or more other changes that failed on some earlier run of migrate
.
When running migrate
in step 3 I included the --fake-initial
flag:
python manage.py migrate --fake-initial
Everything seems to be set right again.
© 2022 - 2024 — McMap. All rights reserved.