aboutsummaryrefslogtreecommitdiff
path: root/utils/create_migration.sh
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2020-01-18 23:20:34 +0000
committerrubenwardy <rw@rubenwardy.com>2020-01-18 23:20:34 +0000
commit64e1805b5387ca3ab7cad55b85b8ae54be076d35 (patch)
tree51e0829622c660346e5b2d515555a92acd10277e /utils/create_migration.sh
parent22d02edbd858649e1c890621d72867d913f8dc57 (diff)
downloadcheatdb-64e1805b5387ca3ab7cad55b85b8ae54be076d35.tar.xz
Add more util scripts
Diffstat (limited to 'utils/create_migration.sh')
-rwxr-xr-xutils/create_migration.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/utils/create_migration.sh b/utils/create_migration.sh
new file mode 100755
index 0000000..910344c
--- /dev/null
+++ b/utils/create_migration.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+# Create a database migration, and copy it back to the host.
+
+docker exec -it contentdb_app_1 sh -c "FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db migrate"
+docker exec -u root -it contentdb_app_1 sh -c "cp /home/cdb/migrations/versions/* /source/migrations/versions/"
+
+USER=$(whoami)
+sudo chown -R $USER:$USER migrations/versions