From 6877e6de56f20c2293533dbe41389de15d9b755a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Alves?= Date: Sat, 31 Jan 2026 00:05:52 -0300 Subject: [PATCH 1/5] Add GitHub Actions workflow for running database migrations --- .github/workflows/run_migrations.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/run_migrations.yml diff --git a/.github/workflows/run_migrations.yml b/.github/workflows/run_migrations.yml new file mode 100644 index 00000000..e423db32 --- /dev/null +++ b/.github/workflows/run_migrations.yml @@ -0,0 +1,22 @@ +name: Run migrations +on: + release: + branches: + - main + pull_request: + types: [opened, synchronize] + +jobs: + run-migrations: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 10.0.0 + - name: Run migrations + working-directory: apps/backend + env: + DATABASE_URL: ${{ secrets.DATABASE_URL }} + run: pnpm run db:migrate \ No newline at end of file From 599e766193032a15d44926feddc672416c8ac6ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Alves?= Date: Sat, 31 Jan 2026 00:12:01 -0300 Subject: [PATCH 2/5] Update GitHub Actions workflow to set environment for CI --- .github/workflows/run_migrations.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run_migrations.yml b/.github/workflows/run_migrations.yml index e423db32..b93b1f1b 100644 --- a/.github/workflows/run_migrations.yml +++ b/.github/workflows/run_migrations.yml @@ -9,6 +9,7 @@ on: jobs: run-migrations: runs-on: ubuntu-latest + environment: CI steps: - uses: actions/checkout@v4 - name: Install pnpm From 836d67f68b632e5465b850645a34a4bed6d02275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Alves?= Date: Sat, 31 Jan 2026 00:14:04 -0300 Subject: [PATCH 3/5] Update GitHub Actions workflow for database migrations --- .github/workflows/run_migrations.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run_migrations.yml b/.github/workflows/run_migrations.yml index b93b1f1b..a7daaa67 100644 --- a/.github/workflows/run_migrations.yml +++ b/.github/workflows/run_migrations.yml @@ -12,12 +12,23 @@ jobs: environment: CI steps: - uses: actions/checkout@v4 + - name: Install pnpm uses: pnpm/action-setup@v4 with: version: 10.0.0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "23" + cache: "pnpm" + + - name: Install dependencies + run: pnpm install --frozen-lockfile + - name: Run migrations working-directory: apps/backend env: DATABASE_URL: ${{ secrets.DATABASE_URL }} - run: pnpm run db:migrate \ No newline at end of file + run: pnpm exec drizzle-kit migrate \ No newline at end of file From 60dd7d39b76a21f66a5f9041c74e2364468fd209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Alves?= Date: Sat, 31 Jan 2026 00:16:10 -0300 Subject: [PATCH 4/5] refactor(drizzle.config): update database URL handling for migrations --- apps/backend/drizzle.config.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/backend/drizzle.config.ts b/apps/backend/drizzle.config.ts index 07d7976e..e1736ada 100644 --- a/apps/backend/drizzle.config.ts +++ b/apps/backend/drizzle.config.ts @@ -1,11 +1,15 @@ import type { Config } from 'drizzle-kit' -import { config } from '@/config' + +const DATABASE_URL = process.env.DATABASE_URL +if (!DATABASE_URL) { + throw new Error('DATABASE_URL is required for migrations') +} export default { schema: 'src/db/schema/index.ts', out: 'src/db/migrations', dialect: 'postgresql', - dbCredentials: { url: config.db.DATABASE_URL }, + dbCredentials: { url: DATABASE_URL }, schemaFilter: ['auth', 'public'], migrations: { prefix: 'timestamp', From 185cdd8317aff66613c46ec4f5a1305973e55292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Alves?= Date: Sat, 31 Jan 2026 00:19:23 -0300 Subject: [PATCH 5/5] Remove pull request trigger from GitHub Actions workflow for running migrations --- .github/workflows/run_migrations.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/run_migrations.yml b/.github/workflows/run_migrations.yml index a7daaa67..41ce5415 100644 --- a/.github/workflows/run_migrations.yml +++ b/.github/workflows/run_migrations.yml @@ -3,8 +3,6 @@ on: release: branches: - main - pull_request: - types: [opened, synchronize] jobs: run-migrations: