Documentation Index
Fetch the complete documentation index at: https://docs.bytebase.com/llms.txt
Use this file to discover all available pages before exploring further.
Automated SQL review validates your migration files during pull/merge requests, catching issues before they reach production.
What Gets Validated
Automated checks include:
- SQL syntax validation
- Policy rule enforcement (200+ configurable rules)
- Naming convention compliance
- Risk assessment for dangerous operations
- Schema compatibility checks
SQL Review Policy
Configure 200+ linting rules for automated validation
Setup
Prerequisites:
- Set up SQL Review Policy - Define your SQL standards
- Install GitOps Integration - Connect Bytebase to your VCS
CI/CD Integration Examples
GitHub Actions
GitLab CI
Azure DevOps
Bitbucket Pipelines
# .github/workflows/sql-review.yml
name: SQL Review
on:
pull_request:
paths:
- 'migrations/**'
jobs:
sql-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: SQL Review
uses: bytebase/sql-review-action@v1
with:
bytebase-url: ${{ secrets.BYTEBASE_URL }}
bytebase-token: ${{ secrets.BYTEBASE_SERVICE_ACCOUNT_TOKEN }}
file-pattern: 'migrations/**/*.sql'

# .gitlab-ci.yml
sql-review:
image: bytebase/bytebase-action:latest
stage: test
only:
- merge_requests
script:
- |
bytebase-action check \
--url $BYTEBASE_URL \
--service-account $BYTEBASE_SERVICE_ACCOUNT \
--service-account-secret $BYTEBASE_SERVICE_ACCOUNT_SECRET \
--file-pattern "migrations/**/*.sql"

# azure-pipelines.yml
trigger: none
pr:
branches:
include:
- main
paths:
include:
- migrations/**
jobs:
- job: SQLReview
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Docker@2
inputs:
command: run
arguments: >
-e BYTEBASE_URL=$(BYTEBASE_URL)
-e BYTEBASE_SERVICE_ACCOUNT=$(BYTEBASE_SERVICE_ACCOUNT)
-e BYTEBASE_SERVICE_ACCOUNT_SECRET=$(BYTEBASE_SERVICE_ACCOUNT_SECRET)
-v $(System.DefaultWorkingDirectory):/workspace
bytebase/bytebase-action
check --file-pattern "/workspace/migrations/**/*.sql"

# bitbucket-pipelines.yml
pipelines:
pull-requests:
'**':
- step:
name: SQL Review
image: bytebase/bytebase-action:latest
script:
- |
bytebase-action check \
--url $BYTEBASE_URL \
--service-account $BYTEBASE_SERVICE_ACCOUNT \
--service-account-secret $BYTEBASE_SERVICE_ACCOUNT_SECRET \
--file-pattern "migrations/**/*.sql"

Review Bot Feedback
The SQL review bot posts detailed feedback as PR/MR comments:
- ✅ Passed checks - Migration meets all policy requirements
- ⚠️ Warnings - Best practice violations (non-blocking by default)
- ❌ Errors - Policy violations (blocking by default)
- 📊 Risk assessment - Evaluation of potential impact
- 📝 Detailed explanations - Why rules failed with fix suggestions
Next Steps
Release
Deploy your migrations after review approval
SQL Review Rules
Explore all available SQL review rules