CODESEEDSign in
Explore projects
PHPbeginnercli

MySQL Schema Diff Tool

CLI PHP that compares the schema of two MySQL databases (or .sql files) and generates the necessary ALTER TABLE script for synchronization.

5 steps

Project steps

  1. 01

    Schema extraction

    PDO connection to both databases and INFORMATION_SCHEMA extraction.

  2. 02

    Table Diff

    Finds: new tables, deleted tables, added/deleted/modified columns.

  3. 03

    Index Diff

    Compares indexes: primary key, unique, index.

  4. 04

    ALTER Generation

    Generates ALTER TABLE ... ADD COLUMN, MODIFY COLUMN, DROP COLUMN, ADD INDEX etc.

  5. 05

    Dry-run & apply

    Displays the generated SQL or executes it with the --apply flag.

Recommended resources

Ready to build this?

Fork the repo on GitHub and start building. A mentor will review your code when you open a PR.

5 steps

Tech stack

PHPPDOSymfony Consoledoctrine/dbal