Prisma migration pipeline in github

pedro-gattaiHOBBY

3 months ago

name: Migrate deploy prisma - PROD

on:
push:
paths:
- prisma/migrations/** # Only run this workflow when migrations are updated
branches:
- main
workflow_dispatch: # Permite execução manual

jobs:
deploy:

  runs-on: ubuntu-latest
    steps:
      - name: Checkout repo
        uses: actions/checkout@v3
      - name: Setup Node
        uses: actions/setup-node@v3
      - name: Install dependencies
        run: npm install
      - name: Apply all pending migrations to the database
        run: npx prisma migrate deploy
        env:
          DATABASE_URL: ${{ secrets.DATABASE_URL_PROD }}

      # Send a notification to Discord if the previous steps fail
      - name: Send Discord notification on failure
        if: failure()  # This step will run only if a previous step fails
        run: |
          curl -H "Content-Type: application/json" \
               -X POST \
               -d "{\"content\": \":warning: Migration failed in the 'developer' branch! Check the logs for more details.\"}" \
               ${{ secrets.DISCORD_WEBHOOK_URL }}

I created this code to run a migrate manualy for my db in raylway, but i cant connect with my database, what url i can put to make my migrations?

0 Replies

3 months ago

I would have to recommend you do your migration in the pre-deploy command -