1

I'm trying to switch database backends for an existing django-cms project, from sqlite3 to postgresql. When I start with a fresh sqlite database and apply all migrations everything works fine. If I do the same with a fresh postgres database everything appears to go ok but I get the following error when trying to do anything:

django.db.utils.ProgrammingError: relation "cms_urlconfrevision" does not exist 
LINE 1: ...sion"."id", "cms_urlconfrevision"."revision" FROM "cms_urlco...

I get a warning while running runserver that there are unapplied migrations despite the fact that a listing of migrations shows all applied, and running migrate again does nothing (makemigrations also does nothing). The cms_urlconfrevision table exists in the database, with the id and revision fields, so I'm at a loss for where to look further.

Adding versions: django 1.9.7, django-cms 3.4.4

1 Answer 1

2

After choosing a new database, first comment out all the other apps you have put in the INSTALLED_APPS. Then makemigration and migrate. If that works then add other apps and create migrations and migrate.

If still it doesn't work.

Try to delete all the earlier created migrations from migrations directory in every app. And then again makemigrations and migrate.

Sign up to request clarification or add additional context in comments.

3 Comments

I've tried commenting out apps in installed apps to go incrementally and the problem still occurs. I'm a little wary of deleting all the migrations from all apps. Are you suggesting all migrations from pip installed apps, not just the ones that live in the project?
Actually for whatever apps you have created .
Ok, that did the trick. Not sure why I didn't try that, thanks!

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.