-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
93bb1e2
commit e67d7f1
Showing
5 changed files
with
53 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
description: Environment in github to target | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
run_migrations: | ||
runs-on: ubuntu-latest | ||
environment: ${{ inputs.environment }} | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Setup pnpm | ||
uses: pnpm/[email protected] | ||
with: | ||
version: 8 | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Run migrations | ||
env: | ||
TURSO_DB_URL: ${{ secrets.TURSO_DB_URL }} | ||
TURSO_DB_AUTH_TOKEN: ${{ secrets.TURSO_DB_AUTH_TOKEN }} | ||
run: pnpm run migrations:run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
import { createClient } from '@libsql/client'; | ||
import 'dotenv/config'; | ||
import { drizzle } from 'drizzle-orm/libsql/driver'; | ||
import { migrate } from 'drizzle-orm/libsql/migrator'; | ||
import { client, connect } from '../src/lib/db/index'; | ||
import * as schema from '../src/lib/db/schema'; | ||
|
||
const db = connect(); | ||
const client = createClient({ | ||
url: process.env.TURSO_DB_URL ?? '', | ||
authToken: process.env.TURSO_DB_AUTH_TOKEN, | ||
}); | ||
const db = drizzle(client, { schema }); | ||
await migrate(db, { migrationsFolder: './drizzle/migrations' }); | ||
client.close(); |