From 3591b1b87793a2734718390691bdde41af1f8bd0 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Fri, 3 Apr 2020 15:19:08 +0100 Subject: big migration reset --- utility/resetting_migrations.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 utility/resetting_migrations.md (limited to 'utility') diff --git a/utility/resetting_migrations.md b/utility/resetting_migrations.md new file mode 100644 index 0000000..e3776bc --- /dev/null +++ b/utility/resetting_migrations.md @@ -0,0 +1,34 @@ +# Resetting Migrations + +When you absolutely balls it up and you want to start again, +Make sure you do the following: + +You first need to remove those pesky migrations from your thing: +```bash +find . -path "*/migrations/*.py" -not -name "__init__.py" -delete +find . -path "*/migrations/*.pyc" -delete +``` + +Then you need to eradicate that old database and create a new one! +In PostgreSQL, that's easy: +```bash +sudo -u postgres psql +DROP DATABASE +CREATE DATBASE +\q +``` + +Now, to recreate those migrations... +Here is what you do: + +```bash +python manage.py makemigrations +python manage.py migrate +``` + +If `allauth` social accounts gives you problems - and it can: +You need to except this app from your application momentarily... +Comment it out of your settings. +Run your migrations again. + +You are good, my friend. -- cgit v1.2.3