Skip to content

Commit

Permalink
chore(ci): add database migration workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bjohansebas committed Mar 23, 2024
1 parent 2cb781f commit 4ded8d6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/migrate-database.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Migrate database
on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
- name: Install dependencies
run: pnpm install
- name: Apply all pending migrations to the database
run: pnpm run migrate
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
DIRECT_URL: ${{ secrets.DIRECT_URL }}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"dev": "turbo dev",
"db:generate": "turbo db:generate",
"db:push": "turbo db:push",
"migrate": "turbo db:migrate",
"lint": "biome check . && turbo lint",
"prepare": "husky"
},
Expand Down
1 change: 1 addition & 0 deletions packages/database/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"db:generate": "prisma generate",
"db:push": "prisma db push --skip-generate",
"db:migrate": "prisma migrate dev",
"db:deploy": "prisma migrate deploy",
"dev": "prisma studio --browser none"
},
"dependencies": {
Expand Down
3 changes: 3 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"db:push": {
"cache": false,
"dotEnv": [".env"]
},
"db:deploy": {
"cache": false
}
}
}

1 comment on commit 4ded8d6

@vercel
Copy link

@vercel vercel bot commented on 4ded8d6 Mar 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.