Friday, April 20, 2018

Error : django.db.utils.ProgrammingError: permission denied for relation django_migrations

While running django migrations for postgresql if you get above error, there may be chances that postgresql user which is used in connection file does not have sufficient permissions to run the migrations command. You need to provide privileges to postgresql user using super user.
1. Log into the database which is going to be migrated using super user
\c database name

2. Run following queries
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public to username;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public to username;
GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public to username;

Change text username with postgresql user which is used in server side postgresql connection file.

Note :
Generally you get this error while running python manage.py migrate 
and above solution works well for this error.

No comments:

Post a Comment