Add database helpers in dev.sh

This commit is contained in:
Grégoire Delattre 2019-07-09 12:55:53 +02:00
parent 3b397300bc
commit d9d71c8ebd

17
dev.sh
View File

@ -26,6 +26,12 @@ _usage() {
echo " $prog front" echo " $prog front"
echo " Install the JS packages and run the frontend" echo " Install the JS packages and run the frontend"
echo "" 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 " $prog db-init"
echo " Refresh the informations (imdb / movies / shows) needed" echo " Refresh the informations (imdb / movies / shows) needed"
echo " before the first run" echo " before the first run"
@ -114,6 +120,17 @@ canape_logout() {
} }
case $1 in 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) back)
# Apply the migrations # Apply the migrations
_migrate -path "$MIGRATION_SCHEMA" up _migrate -path "$MIGRATION_SCHEMA" up