1 Star 0 Fork 44

Tiger / Lancer

forked from alchemystar / Lancer 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Lancer

同步两个DB之间的schema,配置如下:
sourceHost=127.0.0.1:3306
sourceUser=root
sourcePass=123123123
sourceSchema=temp_db
sourceCharset=utf8

targetHost=127.0.0.1:3306
targetUser=root
targetPass=123123123
targetSchema=temp_test
targetCharset=utf8

autoExecute=YES //此处表明自动同步

原理: 通过捞取information_schema来比较source_schema和target_schema(可在不同实例)的表结构是否一致,
如果target_schema没有则这张表则创建,
如果target_schema表里面没有这个字段则alter add(保证顺序),
如果表里面有这个字段、但属性不一样则alter change,
另外还同步索引的元数据.
可以指定进行自动执行,也可以指定打印出对应的执行语句,语句如下所例:
alter table mystique_test.t_test_3 change id id bigint(20) NOT NULL AUTO_INCREMENT COMMENT ''
alter table mystique_test.t_test_3 add index (name)
alter table mystique_test.t_test_3 drop index name_id
alter table mystique_test.t_test_3 add id_2 varchar(50) NULL DEFAULT '' COMMENT '' after name

空文件

简介

MySql之自动同步表结构 能够自动比较RD环境和QA不同的数据库的表结构,并生成对应的alter语句,且自动执行。分析地址: https://my.oschina.net/alchemystar/blog/858996 展开 收起
Java
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/abpnqewx/Lancer.git
git@gitee.com:abpnqewx/Lancer.git
abpnqewx
Lancer
Lancer
master

搜索帮助

14c37bed 8189591 565d56ea 8189591