Schema Sync a MySQL Schema Versioning and Migration Utility

Synopsis

                schemasync [options] <source> <target>

                # source/target format: mysql://user:pass@host:port/database
                # output format: <database>[_<tag>].YYYYMMDD.(patch|revert)[_<version>].sql
            

Description

Schema Sync will generate the SQL necessary to migrate the schema of a source database to a target database (patch script), as well as a the SQL necessary to undo the changes after you apply them (revert script).

Examples

  1. Sync the production db with the changes from the development db
    
        schemasync mysql://user:pass@dev-host:3306/dev_db mysql://user:pass@prod-host:3306/production_db
    
    
  2. Bob and Sally were working on independent parts of the application that required schema changes. Migrate these changes to the SAN so they can be tested and later rolled up to the production db.
    
        schemasync --tag="bob" --ouput-dir="/location/of/san/" \
                       mysql://user:pass@dev-host:3306/dev_db_bob mysql://user:pass@prod-host:3306/production_db
    
    
        schemasync --tag="sally" --ouput-dir="/location/of/san/" \
                     mysql://user:pass@dev-host:3306/dev_db_sally mysql://user:pass@prod-host:3306/production_db
    
    

Options


            -h, --help            show this help message and exit
            -V, --version         show version and exit.
            -r, --revision        increment the migration script version number
                                  if a file with the same name already exists.
            -a, --sync-auto-inc   sync the AUTO_INCREMENT value for each table.
            -c, --sync-comments   sync the COMMENT field for all tables AND columns
            --tag=TAG             tag the migration scripts as <database>_<tag>.
                                  Valid characters include [A-Za-z0-9-_]
            --output-directory=OUTPUT_DIRECTORY
                                directory to write the migration scrips.
                                The default is current working directory.
                                Must use absolute path if provided.
            --log-directory=LOG_DIRECTORY
                                set the directory to write the log to.
                                Must use absolute path if provided.
                                Default is output directory.
                                Log filename is schemasync.log

Download & Install

Prerequisites


To run the test suite, you will need to install the Sakila Database, version 0.8

Installation

             Download SchemaSync-0.9.2

             tar xvzf SchemaSync-0.9.2.tar.gz
             cd SchemaSync-0.9.2
             sudo python setup.py install
             

To install without root access or install the latest development version, see Installation Instructions.

Author

<code at matuson com>

Status & License

Schema Sync is no longer maintained. It is released under the Apache License, Version 2.0.
You can obtain a copy of the latest source code from the Git repository, or fork it on Github.
You can report bugs via the Schema Sync Issues page
Thanks to Ronald Bradford for feedback on the design of Schema Sync