0

I've dropped all tables from my postgres db. Now, while running

python manage.py syncdb

I'm getting error that abc fields doesn't exist in xyz table. It's probably some sort of django cache issue. Error is of this format:

django.db.utils.ProgrammingError: relation "mmb_data_genre" does not exist
LINE 1: ...b_data_genre"."id", "mmb_data_genre"."genre" FROM "mmb_data_...

Any suggestions how to fix this?

Note - I'm using django 1.8.2 and

python manage.py makemigratons

or

python manage.py runserver

is throwing same error.

6
  • This may be due to migrations, before syncing db, you just delete all migrations folder inside you app. Commented Oct 18, 2015 at 12:23
  • I've deleted migrations folders from apps Commented Oct 18, 2015 at 12:39
  • Try deleting all migrations in django_migrations table then run python manage.py makemigrations Commented Oct 18, 2015 at 13:24
  • I've dropped my entire db which includes this table as well. Commented Oct 18, 2015 at 14:38
  • Try deleting any and all .pyc files in your project. Commented Oct 18, 2015 at 16:46

1 Answer 1

1

syncdb in django 1.8 is merely an alias for the migrate command but with the additional step of creating a superuser.

Deprecated since version 1.7: This command has been deprecated in favor of the migrate command, which performs both the old behavior as well as executing migrations.

But syncdb (migrate) should be executed only after you have done makemigrations [app_label] but in your case you seem to have the order in reverse.

Try

./manage.py makemigrations
./manage.py migrate
Sign up to request clarification or add additional context in comments.

2 Comments

Running ./manage.py makemigrations is also throwing same error
If this is a new database, clear it and clear the migrations folder and try those two steps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.