Giter Site home page Giter Site logo

yeym-1979 / db2word Goto Github PK

View Code? Open in Web Editor NEW

This project forked from heartsuit/db2word

0.0 0.0 0.0 29 KB

Extract table structure into word format.数据库(MySQL, PostgreSQL)设计文档生成工具,导出数据表结构为word。

Java 100.00%

db2word's Introduction

数据库设计文档生成工具

共三个分支

  • mysql:将MySQL数据表结构导出为word(基本上原作者的代码)。
  • postgresql:将PostgreSQL数据表结构导出为word
  • combined: 通过多数据源方式,动态切换MySQLPostgreSQL

Note:

  • 如果只是使用这个工具生成数据库设计文档,时间紧迫,则可直接使用mysql或者postgresql分支;

  • 如果想了解下多数据源配置,动态切换数据源,则可以切到combined分支。

效果

  • MySQL

2021-06-09-ExportMySQL.png

mysql分支代码

导出mysql数据表结构到word文档,代码源自:https://github.com/BeliveYourSelf/lv617DbTest

生成word文档

  • 启动Web应用,访问http://localhost:8080/myTest/getDbDetail?dbName=your-db-name

  • 生成地址:D:/data/dbDetail.doc(原作者是硬编码在代码中:DataSourceDetailServiceImpl.toWord方法)

参考SQL

  • 查询所有表名
SELECT table_name, table_comment FROM information_schema.TABLES WHERE table_schema='zaservice';

2021-06-09-TableNameMySQL.png

  • 查询每个表的字段信息
SELECT
        COLUMN_NAME 字段名称,
        COLUMN_TYPE 字段类型,
        COLUMN_DEFAULT 默认值,
        CHARACTER_MAXIMUM_LENGTH AS 最大长度,
        (CASE WHEN is_nullable = 'NO' THEN
                        '' ELSE
                        '' END
        ) AS 是否可空,
        (CASE WHEN column_key = 'PRI' THEN
                        '' ELSE
                        '' END
        ) AS 是否主键,
        EXTRA 其他,
        COLUMN_COMMENT 字段说明
FROM
        INFORMATION_SCHEMA.COLUMNS
WHERE
 table_schema='zaservice' AND
        table_name = 'sys_log'

2021-06-09-TableColumnMySQL.png

Reference

https://github.com/BeliveYourSelf/lv617DbTest


If you have any questions or any bugs are found, please feel free to contact me.

Your comments and suggestions are welcome!

db2word's People

Contributors

heartsuit 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.