Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django 1.8 migrate - relation "django_content_type" already exists

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

like image 221
adamteale Avatar asked Jun 16 '15 18:06

adamteale


2 Answers

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!

like image 156
FlipperPA Avatar answered Sep 27 '22 22:09

FlipperPA


This worked for me:

  1. ./manage.py migrate auth --fake-initial (this throws an error but ignore it)

  2. ./manage.py migrate --fake-initial

like image 43
Andy Baker Avatar answered Sep 27 '22 23:09

Andy Baker