Donna
Donna

Reputation: 657

django 1.7 relation "auth_user" does not exist in migrate but fine in tests

I'm updating a django-1.5 project to django-1.7.2 and when migrating I keep getting "relation "auth_user" does not exist". However if I run python manage.py test -v2 to see the process of database creation/migration

Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying subscription.0001_initial... OK

Migrations turn out fine. Am I missing a step? It is my belief that one does not need to syncdb anymore simply

python manage.py migrate

But doing that does not apply migrations for django apps.

Note: I'm not using a custom User class just the regular django.contrib.auth.models.User

Upvotes: 1

Views: 764

Answers (2)

kmmbvnr
kmmbvnr

Reputation: 6129

May be you faked auth migrations already on real database?

Try to check

select * from django_migrations where app='auth'

and if any records exists, delete them.

Upvotes: 1

317070
317070

Reputation: 847

You need to do 2 things:

python manage.py makemigrations

and then

python manage.py migrate

The migrate does indeed apply the migrations, but they first need to be created. These two steps are more or less the replacement of the old syncdb.

Upvotes: 0

Related Questions