Sometimes when You are trying things out and You feel that Your Django migration files are getting out of hand and You want to start clean it might be a good idea to start fresh.
Instead of truncating separate tables in a large database You can just drop the database and the recreate it.
Follow these steps
- Become the
sudo su postgres
- Jump into the
psqlcommand line tool
- Drop the database with
drop database <YOURDBNAME>;
- Create the database again with
create database <YOURDBNAME>;
- If You are using Django, recreate the database structure with
python manage.py migrate
It should look something like the lines described below...
faisal@tipler:~$ sudo su postgres [sudo] password for faisal: postgres@tipler:~$ psql psql (9.4.9) Type "help" for help. postgres=# drop database django; DROP DATABASE postgres=# create database django; CREATE DATABASE postgres=#\q faisal@tipler:~$ python manage.py migrate