0

On my accounting project.. i have database in postgresql. I has to change model of my project. After changing and appylying migrations for several times i got my database structure very bad. And was unable to appy any futher migrations being my models.py all correct.

So i deleted my database named 'goms'. Deleted my git repo. And agained cloned a working 'develop' branch. After running

./manage.py makemigratins

i get

File "/home/student/work02/lib/python2.7/site-packages/psycopg2/__init__.py", line 164, in connect
conn = _connect(dsn, connection_factory=connection_factory, async=async)
django.db.utils.OperationalError: FATAL:  database "goms" does not exist

I belive the database must be created itself when making and applying migration. It seems psycopg has some cache stored which is searching goms instead of creating one. Plz help m stuck.

1 Answer 1

2

No, you need to create your database before applying the migrations.

If you would follow the official Django tutorial, you may see a note in a Database Setup section:

If you’re using PostgreSQL or MySQL, make sure you’ve created a database by this point. Do that with “CREATE DATABASE database_name;” within your database’s interactive prompt.

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

1 Comment

ok i have create ddatabase again. It has no any relations. But now when i try to make migration.. it is looking for previous fields. saying....django.db.utils.ProgrammingError: relation "core_fiscalyear" does not exist LINE 1: ...e_fiscalyear"."id", "core_fiscalyear"."year" FROM "core_fisc...

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.