From f5664548aa0ef2b8538cb2d04fc16c83e0dcf72a Mon Sep 17 00:00:00 2001 From: William Muli Date: Wed, 20 Sep 2023 14:29:25 +0300 Subject: [PATCH] Run migrations on deploy --- .github/workflows/preview.yaml | 6 +++++- .github/workflows/production.yaml | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 7e6d080..51ab657 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -19,5 +19,9 @@ jobs: run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} - name: Build Project Artifacts run: vercel build --token=${{ secrets.VERCEL_TOKEN }} + - name: Apply all pending migrations to the database + run: npx prisma migrate deploy + env: + DATABASE_URL: ${{ secrets.DATABASE_URL }} - name: Deploy Project Artifacts to Vercel - run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} \ No newline at end of file + run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} diff --git a/.github/workflows/production.yaml b/.github/workflows/production.yaml index 1aadcf5..605abe9 100644 --- a/.github/workflows/production.yaml +++ b/.github/workflows/production.yaml @@ -19,5 +19,9 @@ jobs: run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} - name: Build Project Artifacts run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + - name: Apply all pending migrations to the database + run: npx prisma migrate deploy + env: + DATABASE_URL: ${{ secrets.DATABASE_URL }} - name: Deploy Project Artifacts to Vercel run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}