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

# .github/workflows/schema-diff.yml name: Schema Diff on: [pull_request] jobs: diff: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: aimadetools/race-kimi@main with: old-schema-path: ./schema/base.sql new-schema-path: ./schema/current.sql dialect: postgres post-comment: true github-token: ${{ secrets.GITHUB_TOKEN }} fail-on-breaking: true
View on GitHub โšก Setup Wizard

๐Ÿ’ฌ What the PR comment looks like

SL
SchemaLens Bot
commented 2 minutes ago

๐Ÿ” SchemaLens Schema Diff (Free Tier)

Risk: Medium (42/100) | Breaking changes: 1

Migration Preview

ALTER TABLE users
  ADD COLUMN email_verified_at TIMESTAMP;

-- ... 12 total migration lines.

12 total migration lines. Unlock full migration with SchemaLens Pro

Generated by SchemaLens GitHub Action

๐Ÿ”ด See it live on our repo

We use the SchemaLens GitHub Action on this very repository. Every time we update the demo schema files, the action runs and posts a diff summary.

๐Ÿ‘๏ธ See Interactive PR Demo โ–ถ View Live Action Runs ๐Ÿ“„ Demo Schema v1

Open a pull request that changes demo/schema-v2.sql to see the PR comment in action.

Why add schema diff to CI?

๐Ÿ›ก๏ธ 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.

โšก Zero setup required

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

๐Ÿšฆ Fail the build on breaking changes

Set fail-on-breaking: true and the workflow fails if any dangerous schema changes are detected.

๐Ÿ“Š Risk score at a glance

Each diff gets a 0-100 risk score. High-risk migrations get extra scrutiny in code review.

๐Ÿ”“ 100% free for open source

The free tier includes breaking change detection, risk scoring, and PR comments. No credit card required.

How it works

1

Dump your schema

Export your database schema to a SQL file as part of your workflow (e.g., pg_dump --schema-only or commit your schema file).

2

Compare before and after

The action compares the schema from your base branch against the schema in the PR. Any drift is surfaced instantly.

3

Get a PR comment with the diff

Enable post-comment: true and the action posts a formatted summary directly on the pull request.

Free vs Pro

FeatureFree TierPro (optional)
Schema diff summaryโœ…โœ…
Breaking change detectionโœ…โœ…
Risk scoreโœ…โœ…
PR commentsโœ…โœ…
Full migration SQLFirst 5 linesโœ… Complete script
Markdown exportโœ…โœ…
JSON exportโœ…โœ…
Rate limit15/min30/min

Full configuration reference

# All available inputs with: old-schema-path: ./schema/old.sql # required new-schema-path: ./schema/new.sql # required dialect: postgres # optional: postgres | mysql | sqlite | mssql | oracle format: markdown # optional: json | markdown | sql license-key: ${{ secrets.SCHEMALENS_KEY }} # optional โ€” unlocks full migration SQL fail-on-breaking: false # optional โ€” fail workflow if breaking changes found post-comment: false # optional โ€” post result as PR comment github-token: ${{ secrets.GITHUB_TOKEN }} # required if post-comment is true

Example: PostgreSQL project

# .github/workflows/schema.yml name: Schema Check on: pull_request: paths: - 'migrations/**' - 'schema.sql' jobs: diff: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Get base schema run: | git show origin/${{ github.base_ref }}:schema.sql > schema-base.sql - uses: aimadetools/race-kimi@main with: old-schema-path: schema-base.sql new-schema-path: schema.sql dialect: postgres post-comment: true github-token: ${{ secrets.GITHUB_TOKEN }} fail-on-breaking: true

Start catching schema drift today

Free forever for open source. Upgrade to Pro for full migration generation.

Try SchemaLens Free View Pro Pricing

๐Ÿข Need this for your team?

Get a personalized walkthrough of SchemaLens for your engineering team โ€” including SSO, shared workspaces, and Slack alerts.

Book a Demo Free Team Audit