diff --git a/.github/workflows/prisma-migrations.yml b/.github/workflows/prisma-migrations.yml new file mode 100644 index 0000000..e1d81c6 --- /dev/null +++ b/.github/workflows/prisma-migrations.yml @@ -0,0 +1,35 @@ +name: Prisma Migrations + +on: + push: + paths: + - 'backend/prisma/**' + pull_request: + paths: + - 'backend/prisma/**' + +jobs: + run-migrations: + name: Run Prisma Migrations + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + run: | + cd backend + npm ci + + - name: Run Prisma Migrations + env: + DATABASE_URL: "postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@nr-nmp-database-${{ github.event.number }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public" + run: | + cd backend + npx prisma migrate deploy