{"id":15374305,"url":"https://github.com/yurunsoft/sql-diff","last_synced_at":"2025-04-15T12:31:32.498Z","repository":{"id":59671874,"uuid":"538408554","full_name":"Yurunsoft/sql-diff","owner":"Yurunsoft","description":"本项目实现了比较 MySQL 建表语句的差异，并生成结构同步代码，功能类似 Navicat 的结构同步。","archived":false,"fork":false,"pushed_at":"2023-06-16T01:21:45.000Z","size":31,"stargazers_count":15,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T21:03:23.784Z","etag":null,"topics":["mysql","navicat","sql"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Yurunsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-19T08:40:14.000Z","updated_at":"2024-12-16T05:36:24.000Z","dependencies_parsed_at":"2024-11-08T11:13:20.142Z","dependency_job_id":null,"html_url":"https://github.com/Yurunsoft/sql-diff","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"41f287144503eddaef5b73c7b46fd81b7f159e8a"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yurunsoft%2Fsql-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yurunsoft%2Fsql-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yurunsoft%2Fsql-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yurunsoft%2Fsql-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yurunsoft","download_url":"https://codeload.github.com/Yurunsoft/sql-diff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249072223,"owners_count":21208141,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mysql","navicat","sql"],"created_at":"2024-10-01T13:58:18.096Z","updated_at":"2025-04-15T12:31:32.278Z","avatar_url":"https://github.com/Yurunsoft.png","language":"PHP","readme":"# sql-diff\n\n[![Latest Version](https://img.shields.io/packagist/v/yurunsoft/sql-diff.svg)](https://packagist.org/packages/yurunsoft/sql-diff)\n[![Php Version](https://img.shields.io/badge/php-%3E=7.4-brightgreen.svg)](https://secure.php.net/)\n[![License](https://img.shields.io/badge/license-GPL%202.0-brightgreen.svg)](https://github.com/yurunsoft/sql-diff/blob/master/LICENSE)\n\n## 介绍\n\n本项目实现了比较 MySQL 建表语句的差异，并生成结构同步代码，功能类似 Navicat 的结构同步。\n\n**支持：**\n\n* [x] 表选项（注释、引擎等）\n\n* [x] 字段\n\n* [x] 索引\n\n* [x] 外键\n\n* [x] 分区\n\n* [x] 视图\n\n## 安装\n\n`composer require yurunsoft/sql-diff`\n\n## 使用说明\n\n```php\n$sql1 = \u003c\u003c\u003cSQL\nCREATE TABLE `a` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci\nSQL;\n\n$sql2 = \u003c\u003c\u003cSQL\nCREATE TABLE `a` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci\nSQL;\n\n// 返回将 $sql1 结构升级到 $sql2 的 SQL 语句数组\n$sqls = \\Yurun\\SqlDiff\\SqlDiff::diff($sql1, $sql2);\nvar_dump($sqls);\n```\n\n## 运行环境\n\n* [PHP](https://php.net/) \u003e= 7.4\n\n## 版权信息\n\n本项目依赖 [phpmyadmin/sql-parser](https://github.com/phpmyadmin/sql-parser)，所以开源协议受到污染，必须是 GPL-2.0，所有基于本项目的代码都要开源。\n\n建议开发成轻量的功能单一的，独立脚本、工具、服务，并开源，这样就不违反开源协议了。\n\n## 捐赠\n\n\u003cimg src=\"https://cdn.jsdelivr.net/gh/imiphp/imi@2.1/res/pay.png\"/\u003e\n\n开源不求盈利，多少都是心意，生活不易，随缘随缘……\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyurunsoft%2Fsql-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyurunsoft%2Fsql-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyurunsoft%2Fsql-diff/lists"}