fix: migrations

This commit is contained in:
Davidson Gomes
2024-08-15 13:13:08 -03:00
parent 285a950c67
commit 975f41d58e
7 changed files with 153 additions and 107 deletions

View File

@@ -10,16 +10,16 @@ if [[ "$DATABASE_PROVIDER" == "postgresql" || "$DATABASE_PROVIDER" == "mysql" ]]
export DATABASE_URL
echo "Deploying migrations for $DATABASE_PROVIDER"
echo "Database URL: $DATABASE_URL"
rm -rf ./prisma/migrations
cp -r ./prisma/$DATABASE_PROVIDER-migrations ./prisma/migrations
npx prisma migrate deploy --schema ./prisma/$DATABASE_PROVIDER-schema.prisma
# rm -rf ./prisma/migrations
# cp -r ./prisma/$DATABASE_PROVIDER-migrations ./prisma/migrations
npm run db:deploy
if [ $? -ne 0 ]; then
echo "Migration failed"
exit 1
else
echo "Migration succeeded"
fi
npx prisma generate --schema ./prisma/$DATABASE_PROVIDER-schema.prisma
npm run db:generate
if [ $? -ne 0 ]; then
echo "Prisma generate failed"
exit 1

View File

@@ -10,7 +10,7 @@ if [[ "$DATABASE_PROVIDER" == "postgresql" || "$DATABASE_PROVIDER" == "mysql" ]]
export DATABASE_URL
echo "Generating database for $DATABASE_PROVIDER"
echo "Database URL: $DATABASE_URL"
npx prisma generate --schema=prisma/$DATABASE_PROVIDER-schema.prisma
npm run db:generate
if [ $? -ne 0 ]; then
echo "Prisma generate failed"
exit 1