From 6fd5d8967160c3f550d3875e2c695bd5a15ef683 Mon Sep 17 00:00:00 2001 From: nutcas3 Date: Wed, 29 Apr 2026 02:52:51 +0300 Subject: [PATCH] feat: Add database migration steps to CI and deployment workflows - Add migration execution step in CI workflow before linter runs - Configure DATABASE_URL environment variable for test database connection - Add placeholder migration steps in deploy workflow for staging and production environments - Include commented kubectl exec commands for future implementation in Kubernetes deployments --- .github/workflows/ci.yml | 6 ++++++ .github/workflows/deploy.yml | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e71ab0..c2a0e36 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,6 +40,12 @@ jobs: working-directory: apps/api-server run: go mod download + - name: Run database migrations + working-directory: apps/api-server + env: + DATABASE_URL: postgresql://test_user:test_password@localhost:5432/test_db?sslmode=disable + run: go run cmd/migrate/main.go --action=up + - name: Run linter working-directory: apps/api-server run: | diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9e5790a..afe26c8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -170,6 +170,12 @@ jobs: with: version: 'latest' + - name: Run database migrations + run: | + echo "Running database migrations for staging..." + # kubectl exec -it deployment/api-server -- go run cmd/migrate/main.go --action=up + echo "Staging migrations complete" + - name: Deploy to staging cluster run: | echo "Deploying to staging..." @@ -191,6 +197,12 @@ jobs: with: version: 'latest' + - name: Run database migrations + run: | + echo "Running database migrations for production..." + # kubectl exec -it deployment/api-server -- go run cmd/migrate/main.go --action=up + echo "Production migrations complete" + - name: Deploy to production cluster run: | echo "Deploying to production..."