Initial User Migration Failed with Admin.0001 Dependency [Solved]
remyluslosius opened this issue · 3 comments
After creating the UserManager
and User
models, the migration failed with the error below.
Migration admin.0001_initial is applied before its dependency core_user.0001_initial on database 'default'.
I followed this discussion thread's advice to delete/drop the database.
$ sudo su postgres
$ psql
postgres=# DROP DATABASE coredb;
Now, recreate the database. Remember the user 'core' still exists. There's no need to try to create it.
postgres=# CREATE DATABASE coredb;
postgres=# ALTER ROLE core SET client_encoding TO 'utf8';
postgres=# ALTER ROLE core SET default_transaction_isolation TO 'read committed';
postgres=# ALTER ROLE core SET timezone TO 'UTC';
postgres=# ALTER DATABASE coredb OWNER TO core;
postgres=# GRANT ALL PRIVILEGES ON DATABASE coredb TO core;
If you already ran the "makemigrations" for core_user, simply run python manage.py migrate
It works for me!
Thanks a lot @remyluslosius for bringing this to our attention and sharing a solution for it, we appreciate it!
Hey @koladev32 what do you think about this issue and user suggestion?
Let me know if I should add this to the README in order to bring it to other reader's attention too.
@rajat-packt This is an interesting suggestion if the reader is learning/working with the book. We can point it in the README.md
Thank you very much for this. This solved my problem