aboutsummaryrefslogtreecommitdiffstats
path: root/utility
diff options
context:
space:
mode:
authorMatthew Lemon <matt@matthewlemon.com>2020-09-02 12:04:19 +0100
committerMatthew Lemon <matt@matthewlemon.com>2020-09-02 12:04:19 +0100
commitedd91cb77191b386af95dfaca0b2706c7ee143b9 (patch)
treeb94edf8e069911d0aea4e1acfc23a72a180cb2cf /utility
parent15c89a78c097dc00ad7b8ca3314581ed3b058187 (diff)
parentc406d3da83d20d65c2fc4da7d5d4d5db0f6ad115 (diff)
Merge branch 'db_rewrite' into master
Diffstat (limited to 'utility')
-rwxr-xr-xutility/drop_and_recreate.sh7
-rw-r--r--utility/drop_and_recreate.sql2
-rwxr-xr-xutility/remove_migrations.sh7
3 files changed, 16 insertions, 0 deletions
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..8e3d6d1
--- /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 and contrib..."
+
+find . -path "*/migrations/*.py" -not -name "__init__.py" -not -path "./contrib/*" -not -path "./.venv/*" -delete
+find . -path "*/migrations/*.pyc" -not -path "./contrib/*" -not -path "./.venv/*" -delete
+find . -path "*/migrations/__pycache__" -not -path "./contrib/*" -not -path "./.venv/*" -delete