Skip to content

DB Migration

DB Migration #14

Workflow file for this run

name: DB Migration
on:
push:
branches: [ main ]
paths:
- db/**
pull_request:
branches: [ main ]
paths:
- db/**
workflow_dispatch:
jobs:
validate-migrations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Test flyway migration scripts'
working-directory: ./db
run: |
./run_migrations_test.sh
apply-migrations:
runs-on: ubuntu-latest
environment: production
if: github.ref == 'refs/heads/main'
needs: validate-migrations
steps:
- uses: actions/checkout@v4
- name: Run migration
run: |
docker run --rm \
-v ${PWD}'/db/migrations/:/flyway/sql' \
flyway/flyway:10-alpine \
-url=${{ secrets.DB_JDBC_URL }} -user='${{ secrets.DB_FLYWAY_USER }}' -password='${{ secrets.DB_FLYWAY_PASSWORD }}' migrate