bogdananton / mysql-to-object-mapper
MySQL-to-object-mapper 可以从 SQL 备份或服务器中输出 PHP 对象
1.0.2
2015-11-01 13:16 UTC
Requires
- php: >=5.4.0
- symfony/console: 2.7.*
Requires (Dev)
- mockery/mockery: *
- satooshi/php-coveralls: dev-master
This package is not auto-updated.
Last update: 2024-09-18 09:56:43 UTC
README
扫描 MySQL 结构并将其转换为 PHP 对象。使用 MySQL 文件备份或服务器作为输入。
从 最新发布页面 下载 phar 文件。
命令
MySQL Extractor version 1.0.0
Usage:
command [options] [arguments]
Available commands:
snapshot
snapshot:compare Compares two snapshots and outputs the differences.
snapshot:create Scans a DB and outputs the structure.
sync
sync:compare Compare two server DB instances and outputs their differences.
快照创建命令
Usage: snapshot:create <source> <output> Arguments: source DB instance to be analysed. Format: USER:PASS@HOSTNAME[:PORT]/DATABASE or /PATH/TO/SQL/DUMPS/ output Output folder for the results file(s), where the database structure will be dumped in JSON format. Data will be stored in [databaseName]-[date]-[timestamp].json format. Help: Scans a DB and outputs the structure.
示例输出
{
"Name": "redmine",
"Tables": [
{
"Name": "attachments",
"Fields": [
{
"Id": "id",
"Type": "INT",
"Length": 11,
"Null": false,
"Default": 0,
"Comment": null,
"Autoincrement": true,
"Values": []
},
{
...
}
],
"Keys": [
{
"Column": "id"
},
{
...
},
{
"Label": "index_attachments_on_container_id_and_container_type",
"Columns": [
"container_id",
"container_type"
]
}
]
},
{
"Name": "auth_sources",
"Fields": [
...
]
}
]
}
快照比较命令
Usage: snapshot:compare <source> <destination> Arguments: source Path to the source DB snapshot (JSON file). destination Path to the destination DB snapshot (JSON file) Help: Compares two snapshots and outputs the differences.
示例输出
{
"table-diffs": {
"attachments": {
"field-diffs": {
"container_type": {
"Type": {
"from": "VARCHAR",
"to": "INT"
}
},
"disk_filename": {
"Length": {
"from": 255,
"to": 500
},
"Null": {
"from": false,
"to": true
}
}
},
"field-to-import": [
{
"Id": "container_id",
"Type": "INT",
"Length": 11,
"Null": true,
"Default": 0,
"Comment": null,
"Autoincrement": false,
"Values": []
}
],
"field-to-delete": [
]
}
},
"table-to-import": [],
"table-to-delete": []
}
同步比较命令
Usage: sync:compare <source> <destination> Arguments: source Source server (main / trusted). Format: USER:PASS@HOSTNAME[:PORT]/DATABASE destination Destination server. Format: USER:PASS@HOSTNAME[:PORT]/DATABASE Help: Compare two server DB instances and outputs their differences.
输出与快照比较命令相同。