Skip to content

Commit

Permalink
chore: adds script to deploy database to heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasvmx committed Mar 8, 2022
1 parent dee55c5 commit eecfea5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions deploy-database-prod.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit eecfea5

Please sign in to comment.