Skip to content

django


reset postgres database

Start postgres CLI:

sudo -u postgres psql

Drop database and remake it:

DROP DATABASE db_name;
CREATE DATABASE db_name;

Connect to database and add user:

\c db_name;
GRANT ALL ON SCHEMA public TO clifton;

Delete all migrations. Run the following from the project root:

find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
find . -path "*/migrations/*.pyc" -delete

Make migrations again and migrate:

python3 manage.py makemigrations 
python3 manage.py migrate

See also