Skip to content

wangyuheng/ddl2plantuml

Repository files navigation

Build Status Quality Gate Status Bugs Maintainability Rating

ddl2plantuml

parse ddl sql to plantuml ER diagram

Demo -> https://ddl2plantuml.yuheng.wang

before after
sql diagram result diagram

Run

Run With Command

Create docker container with file binding.

docker run --name ddl2plantuml -v $(pwd)/example/ddl.sql:'/ddl.sql' wangyuheng/ddl2plantuml:latest /ddl.sql

(Optional) Modify ddl.sql

vim example/ddl.sql 

(Optional) Copy Another file to container

docker cp anothe-ddl.sql ddl2plantuml:/ddl.sql

Start container with attach when container has created

docker start -a ddl2plantuml

Run With API

docker run -e D2P_MODE=web -p 8080:8080  wangyuheng/ddl2plantuml:latest

Access web with http://localhost:8080 Or request api with HTTP

curl --location 'localhost:8080/d2p' \
--header 'Content-Type: application/json' \
--data '{
    "ddl": "CREATE TABLE `table_1` (  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '\''column_1'\'',  `prod_name` varchar(20) NOT NULL COMMENT '\''column_2'\'',  `prod_type` tinyint(1) unsigned NOT NULL DEFAULT '\''0'\'' COMMENT '\''column_3 0:活期 1:定期'\'',  `start_time` time NOT NULL COMMENT '\''停止交易开始时间'\'',  `end_time` time NOT NULL COMMENT '\''停止交易结束时间'\'',  `online_type` tinyint(1) unsigned NOT NULL DEFAULT '\''0'\'' COMMENT '\''0:上线 1:未上线'\'',  `prod_info` varchar(2000) NOT NULL DEFAULT '\'''\'' COMMENT '\''产品介绍'\'',  `over_limit` tinyint(1) unsigned NOT NULL DEFAULT '\''0'\'' COMMENT '\''超额限制 0:限制 1:不限制'\'',  `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,  `updated_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,  PRIMARY KEY (`id`)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COMMENT='\''This is table 1;'\'';"
}'

Design

design diagram

Deployment

Build a fat JAR

./gradlew :buildFatJar

Build a Docker image

./gradlew :buildImage
./gradlew :runDocker

About

Convert DDL Sql to PlantUML format ER diagram

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published