File tree Expand file tree Collapse file tree 1 file changed +7
-20
lines changed
Expand file tree Collapse file tree 1 file changed +7
-20
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- # Fonte das variáveis de ambiente
43source ./Docker/scripts/env_functions.sh
54
6- # Carregar variáveis de ambiente se não estiver no ambiente Docker
75if [ " $DOCKER_ENV " != " true" ]; then
86 export_env_vars
97fi
108
11- # Verificar se o banco de dados é PostgreSQL ou MySQL
129if [[ " $DATABASE_PROVIDER " == " postgresql" || " $DATABASE_PROVIDER " == " mysql" ]]; then
1310 export DATABASE_URL
1411 echo " Deploying migrations for $DATABASE_PROVIDER "
1512 echo " Database URL: $DATABASE_URL "
16-
17- # Verificar se há migrações pendentes com Prisma
18- MIGRATION_STATUS=$( npx prisma migrate status)
19-
20- if echo " $MIGRATION_STATUS " | grep -q " Pending" ; then
21- echo " Migrações pendentes encontradas. Executando deploy..."
22- npm run db:deploy # Aplica as migrações pendentes
23- if [ $? -ne 0 ]; then
24- echo " Migration failed"
25- exit 1
26- else
27- echo " Migration succeeded"
28- fi
13+ # rm -rf ./prisma/migrations
14+ # cp -r ./prisma/$DATABASE_PROVIDER-migrations ./prisma/migrations
15+ npm run db:deploy
16+ if [ $? -ne 0 ]; then
17+ echo " Migration failed"
18+ exit 1
2919 else
30- echo " Nenhuma migração pendente. Pulando deploy. "
20+ echo " Migration succeeded "
3121 fi
32-
33- # Gerar o Prisma Client após o deploy
3422 npm run db:generate
3523 if [ $? -ne 0 ]; then
3624 echo " Prisma generate failed"
3725 exit 1
3826 else
3927 echo " Prisma generate succeeded"
4028 fi
41-
4229else
4330 echo " Error: Database provider $DATABASE_PROVIDER invalid."
4431 exit 1
You can’t perform that action at this time.
0 commit comments