From d9d71c8ebd987d4610f5cd6b3566243f799c28ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Delattre?= Date: Tue, 9 Jul 2019 12:55:53 +0200 Subject: [PATCH] Add database helpers in dev.sh --- dev.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dev.sh b/dev.sh index d0c6474..ed00167 100755 --- a/dev.sh +++ b/dev.sh @@ -26,6 +26,12 @@ _usage() { echo " $prog front" echo " Install the JS packages and run the frontend" echo "" + echo " $prog migrate [args]" + echo " Runs the migrate command with the given parameters" + echo "" + echo " $prog db-shell" + echo " Get a psql shell on the database" + echo "" echo " $prog db-init" echo " Refresh the informations (imdb / movies / shows) needed" echo " before the first run" @@ -114,6 +120,17 @@ canape_logout() { } case $1 in + migrate) + shift + _migrate -path "$MIGRATION_SCHEMA" "$@" + ;; + db-shell) + docker run -it --rm \ + -e PGPASSWORD="$DB_PASS" \ + --link canape_postgresql_dev:postgres \ + postgres:9.5 \ + psql -h postgres -U "$DB_USER" -d "$DB_DATABASE" + ;; back) # Apply the migrations _migrate -path "$MIGRATION_SCHEMA" up