🚀 One config, zero friction
Copy this into your repo as .gitlab-ci.yml or let the wizard auto-detect your schema files.
stages:
- validate
schema-diff:
stage: validate
image: node:20-alpine
variables:
SCHEMA_PATH: "db/schema.sql"
DIALECT: "postgres"
POST_MR_COMMENT: "true"
FAIL_ON_BREAKING: "true"
before_script:
- apk add --no-cache git curl jq
script:
- git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
- git show origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME:$SCHEMA_PATH > /tmp/schema_base.sql
- node ci/schemalens-diff.js /tmp/schema_base.sql $SCHEMA_PATH --dialect=$DIALECT --format=markdown --output=/tmp/report.md
- cat /tmp/report.md
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- "**/*.sql"
artifacts:
paths:
- /tmp/report.md
expire_in: 1 week
⚡ Generate my GitLab CI config
Download .gitlab-ci.yml
💬 What your team sees in every merge request
Why GitLab teams use SchemaLens
🛡️ Block breaking changes before merge
Dropped columns, removed indexes, and altered constraints fail the pipeline before they reach production.
💬 Native MR comments
Reviewers see the diff summary directly in the merge request — no external dashboards needed.
📦 Artifact reports
Every pipeline attaches a full markdown report for compliance docs, audits, or offline review.
⏭️ Smart skip saves CI minutes
The job only runs when .sql files change, so unrelated merges don't waste runner time.
Get it running in 3 steps
1
Open the GitLab CI wizard
The wizard auto-detects SQL files from your public GitHub or GitLab repo and selects the right dialect.
2
Copy the generated config
Paste it into .gitlab-ci.yml at the root of your repo. Adjust SCHEMA_PATH if your schema lives elsewhere.
3
Open your next merge request
SchemaLens compares the target branch schema against your branch and posts the result as an MR comment.
🔍 SchemaLens Schema Diff Report