-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: adds script to deploy database to heroku
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |