Drop tables from postgresql on django

serg | Oct. 6, 2020, 1:02 p.m.

I had a trouble when tried to apply intial custom migrations once again after I've already run it. This is how I managed to fix it The sequence of actions is: 1) python manage.py makemigrations 2) python manage.py migrate # oops! 3) Edit 0001_initial.py to load fixtures for a model 4) Oops! As soon as I ran 'migrate" on step 2 - I could not run this migration again 5) python manage.py migrate zero 6) python manage.py flush # this step may be unnecessary 7) python manage.py dbshell 8) \l - to list databases in Postgres 9) \c - to connect it 10) \dt - to show tables 11) DROP TABLE ; 12) exit; 13) I needed to create superuser because I flushed the database on the step 6