Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to "reset" postgresql database?

I am trying to move my django project into a production environment and in doing so I switched from using sqlite to postgres. In my development environment, whenever I made changes to my models or anything that would significantly change how the database was setup, I would literally just drag my sqlite file to the trash and just run syncdb to create a new empty one (probably bad practice). Now that I am using postgres, I am wanting to do the same thing without actually deleting the database. Basically I was wondering if there was a way to completely empty it or clear it out and then just run syncdb and start over?

I also welcome any alternative suggestions that might lead me down the right path, I'm very new to this.

like image 837
david Avatar asked Dec 14 '22 16:12

david


1 Answers

You can use flush. Just run this command:

python manage.py flush
like image 185
ruddra Avatar answered Jan 15 '23 12:01

ruddra