SQL Schema Diff
Compare two sets of CREATE TABLE statements and generate ALTER TABLE migration scripts: added/removed columns, changed types, and new/dropped indexes.
About this tool
SQL Schema Diff compares two sets of CREATE TABLE statements and generates the ALTER TABLE migration script needed to move from the old schema to the new one. It detects added and removed tables and columns, type changes, constraint modifications (nullable, defaults), and index additions/removals.
Example: given a users table with columns (id, name, email) in the old schema and (id, name, email, role) in the new schema, the tool produces ALTER TABLE users ADD COLUMN role VARCHAR(50) NOT NULL DEFAULT 'user';.
This is useful whenever you manage database migrations without an ORM, or when you need to verify that two schema snapshots are in sync before a deployment.
FAQ
Does this connect to a database? ›
No. SQL Schema Diff is a static comparison tool — it parses the DDL text you paste and compares the structures. It never connects to any database server.
Which SQL dialects are supported? ›
The parser handles standard SQL CREATE TABLE syntax (MySQL, PostgreSQL, SQLite). Vendor-specific data types and table options are preserved but constraint differences like ENUM vs CHECK may need manual review. Indexes use the standard CREATE INDEX syntax.
Why are some changes not detected? ›
The parser focuses on column definitions (name, type, nullable, default, auto-increment) and standalone CREATE INDEX statements. Inline constraints (PRIMARY KEY, UNIQUE, CHECK, FOREIGN KEY) and table-level options (ENGINE, CHARSET) are preserved in the DDL but not diffed. For complex migrations involving foreign keys or partition changes, review the generated script manually.
Can I use this with migration tools like Flyway or Alembic? ›
Yes — the generated ALTER TABLE statements are standard SQL and work as a starting point for any migration system. Copy the output into your migration file and adjust ordering and transaction handling as needed.