-1

enter image description here

The drop database command is not working in sql shell. It shows db doesn't exists. But pgadmin and \l shows the db. What is the problem and how to delete the db?

lupin
  • 173
  • 5
  • 19
  • The error message is `database "mydatabase" does not exist`, because the database is named `"myDatabase"`. When quoting identifiers, case matters. – Bergi Aug 06 '22 at 09:56

2 Answers2

2

Try writing "myDatabase" (with quotation marks "") since your name is case-sensitive. In general it is better to use lower-case names in postgres and I think in unix in general.

Omri
  • 483
  • 4
  • 12
-2

1.find . -path "/migrations/.py" -not -name "init.py" -delete

2.find . -path "/migrations/.pyc" -delete [Instead of first 2 steps,you can manually deleting all the files except init.py from migrations folder in all app.]

3.sudo su postgres

4.psql

  1. DROP DATABASE databasename;

6.\q

7.createdb databasename

8.psql

9.grant all privileges on database databasename to username;

10.\q

11.exit

12.source venv/bin/activate

13.python manage.py makemigrations

14.python manage.py migrate

  1. python manage.py createsuperuser

  2. python manage.py runserver

Amina K M
  • 15
  • 3