๐Ÿš€ Add to your pipeline โ€” copy, paste, done

Free for open source and small teams. Upgrade to Team for Slack alerts, shared dashboards, and unlimited members.

# azure-pipelines.yml trigger: branches: include: - main pr: paths: include: - db/schema.sql - migrations/*.sql - **/*.sql pool: vmImage: ubuntu-latest steps: - checkout: self fetchDepth: 0 - task: NodeTool@0 inputs: versionSpec: "20.x" displayName: "Install Node.js" - script: | git fetch origin $(System.PullRequest.TargetBranch) git show origin/$(System.PullRequest.TargetBranch):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 cat /tmp/report.md displayName: "SchemaLens Schema Diff" - task: PublishBuildArtifacts@1 inputs: PathToPublish: "/tmp/report.md" ArtifactName: "schema-diff-report" displayName: "Publish diff report"
Download azure-pipelines.yml โšก Setup Wizard auto-detects schema files

๐Ÿ’ฌ What the PR comment looks like

SL
SchemaLens Bot
commented 2 minutes ago

๐Ÿ” SchemaLens Schema Diff Report

๐ŸŸข Tables Added1
๐Ÿ”ด Tables Removed0
๐ŸŸก Tables Modified2
โš ๏ธ Breaking Changes1
๐Ÿ“Š Risk Score42/100 (Medium)

Generated Migration

ALTER TABLE users
  ADD COLUMN email_verified_at TIMESTAMP;

Generated by SchemaLens Azure DevOps

๐Ÿ“ฆ What the pipeline artifact looks like

schema-diff-report/schema_diff_report.md 2.4 KB

Team members can download the full markdown report from the Build > Artifacts section of any Azure DevOps pipeline run. The report includes:

  • Complete diff summary with table counts
  • Breaking change list with severity levels
  • Generated migration SQL (full script with Pro)
  • Risk score and recommendation

Why add schema diff to Azure DevOps?

๐Ÿ›ก๏ธ Prevent production incidents

Breaking changes like dropped columns, removed indexes, or altered constraints get flagged before merge โ€” not after deploy.

๐Ÿ’ฌ PR comments, automatically

Every pull request gets a clear schema diff summary posted as a comment. Reviewers see exactly what changed without leaving Azure DevOps.

๐Ÿ“ฆ Downloadable artifacts

The full markdown report is attached to every pipeline as an artifact. Download it for compliance docs, audits, or offline review.

โญ๏ธ Smart skip

Path filters let the pipeline skip entirely when no .sql files were modified โ€” saving build minutes.

โšก Zero setup required

No database connections, no CLI installation, no license key. Just point the job at two SQL files.

๐Ÿšฆ Fail the pipeline on breaking changes

Set FAIL_ON_BREAKING: "true" and the pipeline fails if any dangerous schema changes are detected.

๐Ÿ“Š Risk score at a glance

Every diff report includes a 0โ€“100 risk score and a label like Low, Medium, High, or Critical.

๐Ÿ”’ Uses System.AccessToken

Post PR comments using Azure DevOps' built-in $(System.AccessToken) โ€” no extra service connection required.

๐Ÿ“‹ Setup instructions

1

Copy the template

Download azure-pipelines.yml above or use the CI/CD Setup Wizard to customize it for your repo.

2

Add the SchemaLens diff script

Copy ci/schemalens-diff.js into your repository. It has zero npm dependencies and works in any Azure DevOps agent.

Download schemalens-diff.js

3

Grant PR comment permission

To post comments back to the pull request, enable the Contribute to pull requests permission for the Project Collection Build Service account, or use an Azure DevOps PAT stored as a secret variable.

4

Open a pull request

Modify any .sql file and open a PR. The pipeline runs, generates the diff report, and posts it as a PR comment.

๐Ÿ”ง Configuration reference

VariableDefaultDescription
SCHEMA_OLD_PATHdb/schema.sqlPath to the base schema file in the target branch.
SCHEMA_NEW_PATHdb/schema.sqlPath to the current schema file in the PR branch.
DIALECTpostgresSQL dialect: postgres, mysql, sqlite, mssql, oracle.
FAIL_ON_BREAKINGfalseSet to true to fail the build when breaking changes are detected.
POST_PR_COMMENTtrueSet to false to skip posting the PR comment.

Need schema diff in a different CI platform?

SchemaLens works wherever Node.js runs. Pick your platform for a ready-to-use template.

GitHub Actions GitLab CI Bitbucket Jenkins CircleCI

Try SchemaLens free

Paste two schemas and see the diff instantly. No signup required.

Open SchemaLens App โšก Azure DevOps Wizard