diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-04-03 15:19:08 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-04-03 15:19:08 +0100 |
commit | 3591b1b87793a2734718390691bdde41af1f8bd0 (patch) | |
tree | 87b98b1fc755f8aabd83484deca73e09c54b84bd /utility | |
parent | c184c99575e03c8b0248b10c65ca234e11695e8d (diff) |
big migration reset
Diffstat (limited to 'utility')
-rw-r--r-- | utility/resetting_migrations.md | 34 |
1 files changed, 34 insertions, 0 deletions
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 <database_name> +CREATE DATBASE <database_name> +\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. |