Free CI/CD integration — no signup required

Catch schema migration risks
before they merge.

Run SchemaLens in your CI/CD pipeline to automatically diff database schemas on every pull request. Get a markdown report of breaking changes, dropped columns, and missing indexes posted directly to your PR — before it reaches production.

No database connection required. Works with any SQL dump or migration file.

Why run schema diffs in CI/CD?

The cheapest place to fix a migration is before it ships.

🛡️

Block Breaking Changes

Automatically flag dropped tables, removed columns, NOT NULL without defaults, and type narrowing. Stop dangerous migrations at the PR gate.

📝

PR Comments with Diff Reports

SchemaLens posts a formatted markdown diff report as a PR comment. Reviewers see exactly what changed — tables, columns, constraints, indexes — without leaving GitHub.

Zero Dependencies

A single Node.js file with no npm install required. Drop ci/schemalens-diff.js into your repo and run it in any CI platform that supports Node 18+.

🗄️

5 SQL Dialects

PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, and Oracle. Pass --dialect=postgres (or mysql, sqlite, mssql, oracle) and get dialect-aware diff reports.

🔍

Semantic Diff — Not Text Diff

SchemaLens understands CREATE TABLE structure. It compares columns, types, defaults, constraints, indexes, triggers, and views — not just lines of text.

📤

JSON or Markdown Output

Export diff reports as Markdown for human review or JSON for programmatic pipeline gates. Fail the build only when breaking changes are detected.

🚨 Schema Drift Alerts for Teams

Get notified the moment schema drift is detected — and keep a shared history for your team.

🔔

Slack & Teams Notifications

The SchemaLens hosted webhook sends rich alerts to Slack or Microsoft Teams with risk scores, breaking changes, and migration previews.

🔗

Shareable Alert Pages

Every alert generates a public link like schemalens.tech/schema-drift-alert.html#.... Share it in Slack, paste it in Jira, or forward it to on-call.

📊

Team Dashboard

Open alert links to build a local team dashboard with risk trends, breaking change history, and CSV export. No server-side data storage required.

Open Team Dashboard See Sample Alert GitHub Action Setup

GitHub Actions Workflow

Add this workflow to .github/workflows/schema-diff.yml to diff schemas on every SQL-related PR.

🚀 Use the Official SchemaLens GitHub Action (Free)

name: Schema Diff

on:
  pull_request:
    paths:
      - 'db/schema.sql'
      - 'migrations/*.sql'
      - '**/*.sql'

jobs:
  schema-diff:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Run SchemaLens Diff
        id: diff
        run: |
          git show origin/\${{ github.base_ref }}:db/schema.sql > /tmp/schema_base.sql 2>/dev/null || echo "-- No base schema" > /tmp/schema_base.sql
          node ci/schemalens-diff.js /tmp/schema_base.sql db/schema.sql --dialect=postgres --format=markdown --output=/tmp/report.md
          echo "report<> \$GITHUB_OUTPUT
          cat /tmp/report.md >> \$GITHUB_OUTPUT
          echo "EOF" >> \$GITHUB_OUTPUT

      - name: Comment PR
        uses: actions/github-script@v7
        with:
          script: |
            const report = `\${{ steps.diff.outputs.report }}`;
            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: '## SchemaLens Diff Report\n\n' + report
            });

GitLab CI Template

Add this job to .gitlab-ci.yml to run schema diffs on merge requests.

🚀 View Full GitLab CI Guide with MR Comments
schema_diff:
  stage: test
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      changes:
        - db/schema.sql
        - migrations/*.sql
  image: node:20-alpine
  script:
    - git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
    - git show origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME:db/schema.sql > /tmp/schema_base.sql 2>/dev/null || echo "-- No base schema" > /tmp/schema_base.sql
    - node ci/schemalens-diff.js /tmp/schema_base.sql db/schema.sql --dialect=postgres --format=markdown --output=schema_diff_report.md
  artifacts:
    paths:
      - schema_diff_report.md
    expire_in: 1 week

Bitbucket Pipelines

Copy bitbucket-pipelines.yml from this repo or use the template below.

🚀 View Full Bitbucket Pipelines Guide with PR Comments
image: node:20 pipelines: pull-requests: '**': - step: name: Schema Diff script: - git fetch origin $BITBUCKET_PR_DESTINATION_BRANCH - git show origin/$BITBUCKET_PR_DESTINATION_BRANCH:db/schema.sql > /tmp/schema_base.sql 2>/dev/null || echo "-- No base schema" > /tmp/schema_base.sql - node ci/schemalens-diff.js /tmp/schema_base.sql db/schema.sql --dialect=postgres --format=markdown --output=schema_diff_report.md artifacts: - schema_diff_report.md

Jenkins

Add a schema diff stage to your Jenkinsfile. Works with multibranch pipelines and freestyle jobs.

🚀 View Full Jenkins Guide with Build Descriptions
// Jenkinsfile
pipeline {
  agent any
  environment {
    SCHEMA_PATH = 'db/schema.sql'
    DIALECT = 'postgres'
    FAIL_ON_BREAKING = 'true'
    SKIP_NO_SQL_CHANGE = 'true'
  }
  stages {
    stage('Schema Diff') {
      steps {
        sh 'curl -s https://schemalens.tech/ci/jenkins-diff.sh | bash'
      }
    }
  }
  post {
    always {
      archiveArtifacts artifacts: 'schema_diff_report.md'
    }
  }
}

CircleCI

Add a schema diff job to your CircleCI workflow. Works with any GitHub-connected project.

🚀 View Full CircleCI Guide with PR Comments
# .circleci/config.yml
version: 2.1
jobs:
  schema-diff:
    docker:
      - image: cimg/node:20.0
    steps:
      - checkout
      - run:
          name: Schema Diff
          command: curl -s https://schemalens.tech/ci/circleci-diff.sh | bash
      - store_artifacts:
          path: schema_diff_report.md

Standalone CLI

Use the same diff engine locally or in any CI platform.

# Download the CLI
curl -O https://schemalens.tech/ci/schemalens-diff.js

# Basic usage
node ci/schemalens-diff.js old_schema.sql new_schema.sql

# With options
node ci/schemalens-diff.js old_schema.sql new_schema.sql \
  --dialect=postgres \
  --format=markdown \
  --output=diff_report.md

# JSON output for programmatic gates
node ci/schemalens-diff.js old_schema.sql new_schema.sql \
  --dialect=mysql \
  --format=json \
  --output=diff.json

Download schemalens-diff.js · View CI README

Related guides

Add schema review to your pipeline today.

Copy the workflow template, drop in the CLI script, and start catching migration risks before they hit production. Free forever for open source and small teams.

Try SchemaLens Free

No signup required. No data leaves your browser.