SQL Migration Generator (Up / Down)

Draft migration files with matching rollback statements for PostgreSQL, MySQL or SQLite.

Use the tool

Why this tool exists

Choose the change, the table and the details. Create table and add column take definitions one per line; the other changes take column names. The tool validates identifiers, quotes them for the dialect and writes both directions, noting where a rollback cannot restore data (dropping a column) and refusing unsupported cases (adding a foreign key to an existing SQLite table). The SQLite output was executed against a test database.

Review before running: large ALTERs can lock tables, and some dialect differences still need manual care.

No data is sent anywhere: the work happens in your browser, so you can use it offline once the page has loaded.

How to use it

  1. Pick the change type and dialect.
  2. Enter table and column details.
  3. Copy the up and down scripts into your migration tool.
  4. Test on a copy of production data.

Frequently asked questions

Why does drop column have a placeholder rollback?

Dropping loses data and the original definition, so the down step needs your original type.

Can it generate migrations from two schemas?

No, it writes single changes.

Which migration tools can use it?

Any that accept raw SQL, such as Flyway, Liquibase, Alembic or dbmate.

Is my data sent anywhere?

No. Everything is processed in your browser, and the page makes no network requests with your input.