1

I am running AWS Elastic Beans which automatically set up a working postgresql database instance and connection for me. Therefore I do not want to just delete the database instance and configure it myself. I would rather just delete all tables in the database from python/django. I also do not want to delete the content of all tables (what python manage.py flush does).

I want the database to return to a state where I can just run python manage.py migrate and it will create all empty tables from my current model definitions.

Thanks

Lochend
  • 33
  • 3

1 Answers1

2
# Prints the SQL statements that would be executed for the flush command. Will delete all the data from tables in database

django-admin sqlflush

# You can pass the name of your database specifically. Defaults to default.

--database DATABASE

# If you want to delete all the tables of your app, then you can run the command

python manage.py migrate appname zero
Mukul Kumar
  • 2,033
  • 1
  • 7
  • 14
  • I do not want to delete all data from the tables, I want to delete the tables themselves so that I could just run a fresh python manage.py migrate afterwards to get clean tables with my new (maybe changed) models. – Lochend Dec 30 '19 at 00:05
  • python manage.py migrate appname zero - command will delete your table – Mukul Kumar Dec 30 '19 at 00:25