比对两个数据库中数据表结构异同

介绍一个工具用于对比两个数据库数据表结构异同---schema sync(官网:http://schemasync.org/)

是由python写成, 比较两个库结构的时候生成一个patch脚本和一个revert脚本

由于是python写的故需要安装python,MySQLDB支持等

依赖关系

  • Python 2.4, 2.5, or 2.6

  • MySQL, version 5.0 or higher

  • MySQLdb, version 1.2.1p2 or higher

  • SchemaObject 0.5.3 or higher (Auto installed with Schema Sync)

安装:

wget http://www.schemasync.org/downloads/SchemaSync-0.9.2.tar.gz

tar xvzf SchemaSync-0.9.2.tar.gz    

cd SchemaSync-0.9.2  

sudo python setup.py install


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



详细了解看官网::http://schemasync.org/

你可能感兴趣的:(schemasync)