composer require peng49/db2markdown
php vendor/bin/db2markdown
输入数据库的 地址(host), 端口(port) 用户名,密码,要导出的表,默认是*,生成所有表的文档,指定多个表明用逗号隔开,如: table1,table2
$ php src/bin/db2markdown
please enter the db(1 mysql,2 postgresql):
please enter the host(localhost):
please enter the port(3306): 3310
please enter username(root):
please enter password: password
please enter database: acg
please enter tables(default is *,match all table):
admin_menu successful
admin_operation_log successful
admin_permissions successful
....
E:\develop\db2markdown\db2markdown20230712091813.md is export success
导出 PostgreSQL 结构
$ php src/bin/db2markdown
please enter the db(1 mysql,2 postgresql): 3
please enter the db(1 mysql,2 postgresql): 2
please enter the host(localhost):
please enter the port(5432): 5432
please enter username(root): odoo
please enter password: password
please enter database: gocron
please enter table schema(public):
please enter tables(default is *,match all table):
task successful
task_log successful
host successful
......
E:\develop\db2markdown\db2markdown20230712092030.md is export success
<?php
require_once "vendor/autoload.php";
/* @var $generator \DB2Markdown\Generator\Mysql */
$generator = \DB2Markdown\Factory::getGenerator('mysql');
//mysql
$generator->setHost('localhost')
->setPort(3306)
->setDatabase('database')
->setUsername('username')
->setPassword('password')
->output("filename", "*");
Github: https://github.com/peng49/db2markdown
Packagist: https://packagist.org/packages/peng49/db2markdown
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.