Skip to main content

Overview

A typical CI/CD workflow:

GitHub Actions

Schema Validation on PRs

.github/workflows/schema-check.yml:

Generate Migrations on Merge

.github/workflows/generate-migrations.yml:

Deploy Migrations

.github/workflows/deploy.yml:

GitLab CI

.gitlab-ci.yml:

Docker Compose for Local Development

docker-compose.yml:
Usage:

Makefile

Makefile:

Best Practices

  • Use different databases for CI testing vs. production
  • Never expose production credentials in CI logs
  • Use environment-specific secrets
  • Test migrations against a copy of production data
  • Use staging environments for validation
  • Implement rollback procedures
  • Automate validation and generation
  • Require manual review for breaking changes
  • Use approval gates for production deployments
  • Log migration results
  • Alert on migration failures
  • Track migration duration for performance monitoring

See Also