7

Steps I did: 1. Deleted migration files. 2.created only one initial migration file. 3. Enter psql command prompt. Connect to database. drop schema public cascade; create schema public; 4.tried to migrate again.

I get MigrationSchemaMissing(Unable to create the django_migrations table (%s) % exc) Error.

Vipul Vishnu av
  • 486
  • 1
  • 5
  • 15

2 Answers2

8

This answer and the comment on its question works for me, in brief you must get required grant for a schema as below:

grant usage on schema public to username;
grant create on schema public to username;
Community
  • 1
  • 1
motam
  • 677
  • 1
  • 6
  • 24
  • 2
    After I ran this for username=djangouser I'm getting `django.db.utils.ProgrammingError: permission denied for relation django_migrations` – citynorman Apr 15 '18 at 16:38
  • I use host mysql at [.freemysqlhosting.net](https://www.freemysqlhosting.net/) and run `grant usage on schema public to username; grant create on schema public to username;` in [phpmyadmin.co](http://www.phpmyadmin.co), but two commands not execute. Please help me. – tnductam Oct 11 '18 at 16:09
-1

I simply deleted the database and recreated and then ran the migration again to solve this problem.

DROP DATABASE database_name

% python manage.py migrate

saurav
  • 1