The SchemaLens diff engine is open source. Inspect the parser, audit the diff algorithm, and self-host if you want. We believe schema diff is infrastructure — and infrastructure should be transparent.
Database schemas are sensitive. When you paste CREATE TABLE statements into a tool, you need to trust what happens next. Closed-source diff tools ask you to believe their marketing. We think the code should speak for itself.
Our engine is a plain JavaScript module with zero runtime dependencies. It parses SQL into an AST, runs a semantic diff at the table/column/index level, and generates migration scripts. Every step is inspectable.
The engine is a single JavaScript file with a clear data flow. No frameworks. No magic.
Custom tokenizer splits SQL into statements, then builds an abstract syntax tree for tables, columns, indexes, constraints, views, functions, and triggers.
Compares schemas object-by-object (not line-by-line). Detects added/removed tables, column type changes, default value drift, index modifications, and renamed objects via Levenshtein heuristic.
Calculates a risk score (Low / Medium / High) based on change severity. Flags breaking changes like dropped columns used by views, type narrowing, and NOT NULL additions without defaults.
Generates dialect-specific ALTER TABLE scripts for PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, Oracle, and generic ANSI SQL.
The engine is available as a standalone npm package. Install it in Node.js, a serverless function, or bundle it for the browser.
npm install schemalens-engine
const { diffSchemas, generateMigration, detectBreakingChanges } = require('schemalens-engine');
const result = diffSchemas(oldSQL, newSQL, { dialect: 'postgres' });
console.log(result.addedTables);
console.log(result.modifiedTables);
const migration = generateMigration(result, { dialect: 'postgres' });
console.log(migration);
const breaking = detectBreakingChanges(result);
console.log(breaking.length + ' breaking changes found');
WITHOUT ROWID and STRICT tablesWe know developers are skeptical of new tools. Here is how we address the common concerns:
The engine runs entirely in your browser or your own server. When you use schemalens.tech, the web app loads the engine as a local JavaScript file. Your SQL never leaves your machine. You can verify this in the Network tab — zero uploads.
The diff algorithm is deterministic and fully testable. We ship with 17+ unit tests covering edge cases like composite primary keys, foreign key cascades, and generated columns. You can run the test suite locally with node test-all.js.
Those are excellent tools for managed migration lifecycles. SchemaLens fills a different niche: instant, zero-setup ad-hoc diffs when you have two DDL dumps and need to see what changed in 10 seconds. Our open-source engine means you can also embed the diff logic into your own CI pipeline without pulling in a heavy framework.
We welcome bug reports, feature requests, and pull requests. The engine is intentionally simple — we want to keep it that way. Before contributing, please read our guidelines:
test-all.js.Found a parsing edge case? Open an issue with the minimal SQL that reproduces it. We'll add it to the test suite and fix it.
SchemaLens Engine is released under the MIT License.
MIT License
Copyright (c) 2026 SchemaLens
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND...
In plain English: you can use the engine in commercial projects, modify it, redistribute it, and even sell tools built on top of it. We only ask that you include the license notice.
No install. No account. Paste two schemas and see the diff in 10 seconds.
Open SchemaLensOr install the CLI and diff schemas from your terminal.