From 75c34b747fc3f6cc776266200db4d1177ca7093e Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 27 Aug 2020 13:56:26 +0100 Subject: added utility scripts for dropping database, etc --- utility/drop_and_recreate.sh | 7 +++++++ utility/drop_and_recreate.sql | 2 ++ utility/remove_migrations.sh | 7 +++++++ 3 files changed, 16 insertions(+) create mode 100755 utility/drop_and_recreate.sh create mode 100644 utility/drop_and_recreate.sql create mode 100755 utility/remove_migrations.sh diff --git a/utility/drop_and_recreate.sh b/utility/drop_and_recreate.sh new file mode 100755 index 0000000..89734f4 --- /dev/null +++ b/utility/drop_and_recreate.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +echo "Ensure this is run from project root." +echo "Dropping database..." +sudo -u postgres psql -f utility/drop_and_recreate.sql +echo "Done." + diff --git a/utility/drop_and_recreate.sql b/utility/drop_and_recreate.sql new file mode 100644 index 0000000..4e03e74 --- /dev/null +++ b/utility/drop_and_recreate.sql @@ -0,0 +1,2 @@ +DROP DATABASE ctrack; +CREATE DATABASE ctrack; diff --git a/utility/remove_migrations.sh b/utility/remove_migrations.sh new file mode 100755 index 0000000..6b8960a --- /dev/null +++ b/utility/remove_migrations.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +echo "Removing migrations from all migrations directories, except in .venv..." + +find . -path "*/migrations/*.py" -not -name "__init__.py" -not -path "./.venv/*" -delete +find . -path "*/migrations/*.pyc" -not -path "./.venv/*" -delete +find . -path "*/migrations/__pycache__" -not -path "./.venv/*" -delete -- cgit v1.2.3