Coder Social home page Coder Social logo

sql2md's Introduction

sql2md

a tool to export sql table schema to markdown table

Install

release pkg

Usage

Usage of ./sql2md:
  -P int
        mysql port (default 3306)
  -h string
        mysql host (default "127.0.0.1")
  -n string
        mysql database name (default "mysql")
  -o string
        markdown output location (default ".")
  -p string
        mysql password (default "root")
  -s string
        sqlite database path
  -t string
        mysql tables, support ',' separator for filter, default all tables
  -u string
        mysql username (default "root")
  -d    show sql debug log
  -v    show version and exit

example:

$ ./sql2md -p 123456 -n bmi_vdms 
connect to mysql ok
open markdown file ...
write markdown header ...
1/5 creating table authorization ...
2/5 creating table casbin_rule ...
3/5 creating table d_video ...
4/5 creating table s_video ...
5/5 creating table video ...
write ./bmi_vdms.md done.

markdown output:

# bmi_vdms 数据库表结构

## authorization

| 序号 | 列名          | 类型        | 主键 | 为空 | 默认值 | 额外信息       | 注释              |
| ---- | ------------- | ----------- | ---- | ---- | ------ | -------------- | ----------------- |
| 1    | `id`          | bigint(20)  | PRI  | NO   |        | auto_increment |                   |
| 2    | `code`        | varchar(32) |      | YES  |        |                | 授权码            |
| 3    | `is_use`      | tinyint(4)  |      | YES  | 0      |                | 1:注册,0:未注册 |
| 4    | `location_id` | bigint(20)  | UNI  | YES  |        |                |                   |

## casbin_rule

| 序号 | 列名    | 类型         | 主键 | 为空 | 默认值 | 额外信息       | 注释                   |
| ---- | ------- | ------------ | ---- | ---- | ------ | -------------- | ---------------------- |
| 1    | `id`    | int(11)      | PRI  | NO   |        | auto_increment |                        |
| 2    | `ptype` | varchar(100) | MUL  | YES  |        |                |                        |
| 3    | `v0`    | varchar(100) |      | YES  |        |                | 角色(id)               |
| 4    | `v1`    | varchar(100) |      | YES  |        |                | p:请求 path / g:父角色 |
| 5    | `v2`    | varchar(100) |      | YES  |        |                | 请求 method            |
| 6    | `v3`    | varchar(100) |      | YES  |        |                | 注释                   |
| 7    | `v4`    | varchar(100) |      | YES  |        |                |                        |
| 8    | `v5`    | varchar(100) |      | YES  |        |                |                        |

table preview:

authorization

序号 列名 类型 主键 为空 默认值 额外信息 注释
1 id bigint(20) PRI NO auto_increment
2 code varchar(32) YES 授权码
3 is_use tinyint(4) YES 0 1:注册,0:未注册
4 location_id bigint(20) UNI YES

Todo list

  • add sqlite support
  • add mongodb support

sql2md's People

Contributors

seek4self avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.