I'm trying to drop a single table from my App's database in a Django project. When I enter the database shell using manage.py dbshell
, I try to execute DROP TABLE mytable;
and get ERROR: table "mytable" does not exist
I think the cause of this stems from the database thinking I'm in my project directory instead of my app directory but I don't know how to change that.
This is what the shell looks like after I type ./manage.py dbshell
:
myproject=# DROP TABLE mytable;
ERROR: table "mytable" does not exist
I think instead of myproject=#
it should say something like myapp=#
or myproject/myapp=#
but I do not know how to accomplish this.
After accessing your local db via: sudo -i -u postgres
Or python manage.py dbshell
Try typing \l
to see what databases do you actually have
Then \dt
to see a list of relations
And then DROP TABLE some_table;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With