From eecfea545d70769eaa6a3df3bc9ff61188c5d2fc Mon Sep 17 00:00:00 2001 From: Lucas Vieira Date: Mon, 7 Mar 2022 22:56:07 -0300 Subject: [PATCH] chore: adds script to deploy database to heroku --- deploy-database-prod.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 deploy-database-prod.sh diff --git a/deploy-database-prod.sh b/deploy-database-prod.sh new file mode 100755 index 0000000..c8d77dd --- /dev/null +++ b/deploy-database-prod.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Script shell para executar as migrations no banco de dados do heroku + +if [ -z "$DATABASE_URL" ]; then + echo "[!] A variável DATABASE_URL está indefinida" + echo "[+] Rode o comando: export DATABASE_URL..." + exit 1 +fi + +npx sequelize db:migrate --config src/database/config/config.json +if [ "$?" != 0 ]; then + echo "[!] Ocorreu um erro ao executar o deploy" + exit 1 +fi + +npx sequelize db:seed:all --config src/database/config/config.json +if [ "$?" != 0 ]; then + echo "[!] Ocorreu um erro ao rodar as migrations" + exit 1 +fi \ No newline at end of file