prisma: adjusts for mysql and postgres

This commit is contained in:
Davidson Gomes 2024-08-09 07:59:50 -03:00
parent 678f2c2b5d
commit 9bf17f27f0
2 changed files with 5 additions and 1 deletions

2
.gitignore vendored
View File

@ -43,3 +43,5 @@ lerna-debug.log*
.DS_Store
*.DS_Store
.tool-versions
/prisma/migrations/*

View File

@ -10,7 +10,9 @@ if [[ "$DATABASE_PROVIDER" == "postgresql" || "$DATABASE_PROVIDER" == "mysql" ]]
export DATABASE_URL
echo "Deploying migrations for $DATABASE_PROVIDER"
echo "Database URL: $DATABASE_URL"
npx prisma migrate deploy --schema ./prisma/$DATABASE_PROVIDER-schema.prisma --migrations ./prisma/migrations/$DATABASE_PROVIDER
rm -rf ./prisma/migrations
cp -r ./prisma/$DATABASE_PROVIDER-migrations ./prisma/migrations
npx prisma migrate deploy --schema ./prisma/$DATABASE_PROVIDER-schema.prisma
if [ $? -ne 0 ]; then
echo "Migration failed"
exit 1