SQL schema diff
Compare two CREATE TABLE schemas and generate the ALTER TABLE migration between them.
SQL schema diff
Paste your current schema on the left and the schema you want to reach on the right, and this tool writes the migration between them. It compares CREATE TABLE statements table by table and column by column, then generates the CREATE TABLE, DROP TABLE, ADD COLUMN, DROP COLUMN and ALTER COLUMN statements needed to turn the first schema into the second — useful for reviewing a schema change, writing a migration file by hand, or checking what a schema-generation tool actually did.
Pick a database from the Database option — PostgreSQL, MySQL or SQLite — since each writes column changes differently: PostgreSQL uses ALTER COLUMN ... TYPE and SET/DROP NOT NULL, MySQL combines type and nullability into one MODIFY COLUMN statement, and SQLite has no ALTER COLUMN at all, so those cases are noted as needing a table rebuild. Include index changes to also diff CREATE INDEX statements, wrap the output in a transaction, and turn on the rollback option for a second, reverse migration appended below the first.
Dropping a table or column, narrowing a type, or adding NOT NULL can throw away data or fail against rows that don't fit the new constraint. With "Warn about data loss" on, every such step is marked in the output so it's easy to spot before running anything against a real database. Tables that reference each other through a foreign key are created and dropped in dependency order, so the script doesn't fail on a table it needed first.
Everything runs locally in your browser — your schemas are never uploaded anywhere, so it's safe to paste real table definitions from a private database. Copy the migration, download it as a .txt file, or send the output back into the input to keep refining it.