定制 eliasfarah/db-struct-sync 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

eliasfarah/db-struct-sync

Composer 安装命令:

composer require eliasfarah/db-struct-sync

包简介

mysql structure syncronisation tool

README 文档

README

Original Owner of this project is https://github.com/gerkirill/dbStructSync

The class provides ability to compare 2 database structure dumps and compile a set of sql statements to update
one database to make it structure identical to another.

The input for the script could be taken from the phpMyAdmin structure dump, or provided by some custom code
that uses 'SHOW CREATE TABLE' query to get database structure table by table.
The output is either array of sql statements suitable for executions right from php or a string where the
statements are placed each at new line and delimited with ';' - suitable for execution from phpMyAdmin SQL
page.
The resulting sql may contain queries that aim to:
Create missing table (CREATE TABLE query)
Delete table which should not longer exist (DROP TABLE query)
Update, drop or add table field or index definition (ALTER TABLE query)

Some features:
- AUTO_INCREMENT value is ommited during the comparison and in resulting CREATE TABLE sql
- fields with definitions like "(var)char (255) NOT NULL default ''" and "(var)char (255) NOT NULL" are treated
  as equal, the same for (big|tiny)int NOT NULL default 0;
- IF NOT EXISTS is automatically added to the resulting sql CREATE TABLE statement
- fields updating queries always come before key modification ones for each table
Not implemented:
- The class even does not try to insert or re-order fields in the same order as in the original table.
  Does order matter?
IMPORTANT!!! Class will not handle a case when the field was renamed. It will generate 2 queries - one to drop
the column with the old name and one to create column with the new name, so if there is a data in the dropped
column, it will be lost.
Usage example:
$updater = new dbStructUpdater();
$res = $updater->getUpdates($struct1, $struct2);
-----
$res == array (
	[0]=>"ALTER TABLE `b` MODIFY `name` varchar(255) NOT NULL",
	...
)

统计信息

  • 总下载量: 18
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2018-09-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固