https://github.com/slince/sql-to-markdown
Convert mysql table schema to markdown table.
https://github.com/slince/sql-to-markdown
database-markdown sql-to-markdown
Last synced: 3 months ago
JSON representation
Convert mysql table schema to markdown table.
- Host: GitHub
- URL: https://github.com/slince/sql-to-markdown
- Owner: slince
- Created: 2019-08-28T10:59:49.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-04-02T12:26:00.000Z (over 3 years ago)
- Last Synced: 2025-05-23T17:14:36.159Z (5 months ago)
- Topics: database-markdown, sql-to-markdown
- Language: PHP
- Homepage:
- Size: 13.7 KB
- Stars: 16
- Watchers: 1
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sql To Markdown
Sql To Markdown 是一个可以将数据表的建表语句转换为 Markdown 表格的工具。
## Installation
通过 Composer 安装
```bash
$ composer global require slince/sql-to-markdown
```## Usage
假设有一张表结构如下,将改sql保存到文件命名为 `foo.sql`
```sql
CREATE TABLE `hello_sql_to_markdown` (
`id` int unsigned NOT NULL AUTO_INCREMENT default '0' COMMENT 'primary',
`foo` decimal (20, 2) unsigned NOT NULL default '' COMMENT 'foo field',
`bar` varchar (20) unsigned NOT NULL default '' COMMENT 'bar field',
PRIMARY KEY (`id`),
) ENGINE=InnoDB AUTO_INCREMENT=2367038934 DEFAULT CHARSET=utf8mb4 COMMENT='Demo table schema';
```执行下面命令:
```bash
$ sql2markdown convert --source=foo.sql
```即可在当前文件夹下生成 `foo.sql.md` 文件。
| name | type | length | default | comment |
|------|---------|--------|---------|-----------|
| id | INT | | 0 | primary |
| foo | DECIMAL | 20,2 | | foo field |
| bar | VARCHAR | 20 | | bar field |支持在一个文件里添加多个 DDL
## 查看帮助
```bash
$ sql2markdown --help
```
## License
The MIT license. See [MIT](https://opensource.org/licenses/MIT)