All Projects → grafov → plantuml2mysql

grafov / plantuml2mysql

Licence: other
This utility parses PlantUML class diagram and generates SQL DDL for MySQL

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to plantuml2mysql

PlantUml-Language-Service
PlantUml Language Service extension for Visual Studio 2017 and 2019
Stars: ✭ 24 (-78.18%)
Mutual labels:  diagram, plantuml, uml-diagram
idle
parse source code(objective-c, java) generate uml(class diagram)
Stars: ✭ 44 (-60%)
Mutual labels:  diagram, plantuml
Plantuml Icon Font Sprites
plantuml-font-icon-sprites
Stars: ✭ 242 (+120%)
Mutual labels:  diagram, plantuml
C4-PlantumlSkin
This library provides skinning to create C4 diagrams using PlantUml
Stars: ✭ 74 (-32.73%)
Mutual labels:  diagram, plantuml
Jekyll Spaceship
🚀 A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, mermaid, emoji, video, audio, youtube, vimeo, dailymotion, soundcloud, spotify, etc.
Stars: ✭ 196 (+78.18%)
Mutual labels:  diagram, plantuml
erdiagram
Entity-Relationship diagram code generator library
Stars: ✭ 28 (-74.55%)
Mutual labels:  diagram, plantuml
Aws Plantuml
PlantUML sprites, macros, and other includes for AWS components.
Stars: ✭ 565 (+413.64%)
Mutual labels:  diagram, plantuml
mkdocs build plantuml
MkDocs plugin to help generate your plantuml images locally or remotely as files (NOT inline)
Stars: ✭ 31 (-71.82%)
Mutual labels:  plantuml, uml-diagram
Asciidoctor Kroki
Asciidoctor.js extension to convert diagrams to images using Kroki!
Stars: ✭ 55 (-50%)
Mutual labels:  diagram, plantuml
X6
🚀 JavaScript diagramming library that uses SVG and HTML for rendering.
Stars: ✭ 2,686 (+2341.82%)
Mutual labels:  diagram, uml-diagram
Umldoclet
Automatically generate PlantUML diagrams in javadoc
Stars: ✭ 138 (+25.45%)
Mutual labels:  diagram, plantuml
C4 Plantuml
C4-PlantUML combines the benefits of PlantUML and the C4 model for providing a simple way of describing and communicate software architectures
Stars: ✭ 3,522 (+3101.82%)
Mutual labels:  diagram, plantuml
PlantUml.Net
a .Net wrapper for PlantUml
Stars: ✭ 35 (-68.18%)
Mutual labels:  diagram, plantuml
plantuml-libs
A set of PlantUML libraries and a NPM cli tool to design diagrams which focus on several technologies/approaches: Amazon Web Services (AWS), Azure, Google Cloud Platform (GCP), C4 Model or even EventStorming and more.
Stars: ✭ 75 (-31.82%)
Mutual labels:  diagram, plantuml
salesforce-plantuml
Salesforce app to generate UML class & ER-diagrams from your org data. Leverages the PlantUML library.
Stars: ✭ 89 (-19.09%)
Mutual labels:  plantuml, uml-diagram
Goplantuml
PlantUML Class Diagram Generator for golang projects
Stars: ✭ 352 (+220%)
Mutual labels:  diagram, plantuml
PlantUML-colors
This script is to show all named color suggested by PlantUML
Stars: ✭ 52 (-52.73%)
Mutual labels:  plantuml, uml-diagram
dcdg.dart
Dart Class Diagram Generator
Stars: ✭ 98 (-10.91%)
Mutual labels:  plantuml, uml-diagram
Arkit
JavaScript architecture diagrams and dependency graphs
Stars: ✭ 671 (+510%)
Mutual labels:  diagram, plantuml
Go Plantuml
Generate plantuml diagrams from go source files or directories
Stars: ✭ 167 (+51.82%)
Mutual labels:  diagram, plantuml

plantuml2mysql

I liked plantuml tool for UML diagrams but use it also for visualizing structure of relational database. This script loads plantuml class diagram and generates DDL for MySQL SQL dialect. You may define primary keys with # prefix in field name (it means protected field in PlantUML) and define index fields with + (public field in PlantUML) prefix.

Field type noted after field name as is. Also you may use comments after --.

For example class definition:

@startuml

class dummy {
  Sample table.
  ==
  #id int(10) -- A comment
  field1 int(10)
  .. Comment line, ignored ..
  field2 varchar(128)
}

@enduml

will be converted to SQL:

CREATE TABLE IF NOT EXISTS `dummy` (
  id               INT(10) COMMENT 'A comment',
  field1           INT(10),
  field2           VARCHAR(128),
  PRIMARY KEY (id));

Text between class name and == is table description. The description of the table is mandatory. I was too lazy to check for absence of descriptions but not lazy to write them in each table of my databases.

A line starting with .. or __, used as a separator into a class definition, will be ignored.

The HTML markup in comments (after --) is stripped.

See below the result of a more complicated sample from database.plu:

database.png

    ./plantuml2mysql.py database.plu sampledb
    CREATE DATABASE sampledb CHARACTER SET = utf8 COLLATE = utf8_unicode_ci;
    USE sampledb;                                                           
                                                                            
    CREATE TABLE IF NOT EXISTS `user` (                                       
      id               SERIAL,                                              
      login            VARCHAR(16),                                         
      mail             VARCHAR(64),                                         
      docsRef          INT(10) COMMENT 'referenced docs for a user',        
      created          INT(11),                                             
      sesid            INT(11),                                             
      PRIMARY KEY (id),                                                     
      INDEX (login),                                                        
      INDEX (mail)                                                          
    );                                                                      
                                                                            
    CREATE TABLE IF NOT EXISTS `session` (                                    
      id               SERIAL,                                              
      uid              INT(10) UNSIGNED,                                    
      remoteip         INT(10) UNSIGNED,                                    
      useragent        VARCHAR(255),                                        
      data             LONGTEXT COMMENT 'serialized session data',          
      lastseen         INT(11),                                             
      PRIMARY KEY (id),                                                     
      INDEX (uid),                                                          
      INDEX (lastseen)                                                      
    );                                                                      
                                                                            
    CREATE TABLE IF NOT EXISTS `docs` (                                       
      id               INT(10),                                             
      fid              INT(10) COMMENT 'link to a file',                    
      aunthorid        INT(10),                                             
      created          INT(11),                                             
      PRIMARY KEY (id, fid),                                                
      INDEX (aunthorid),                                                    
      INDEX (created)                                                       
    );                                                                      
                                                                            
    CREATE TABLE IF NOT EXISTS `files` (                                      
      id               SERIAL,                                              
      docId            INT(10),                                             
      title            VARCHAR(255),                                        
      path             VARCHAR(255),                                        
      hash             INT(32) UNSIGNED,                                    
      PRIMARY KEY (id),                                                     
      INDEX (docId)                                                         
    );                                                                      

Installation

The script not uses external dependencies. If you have installed Python 3 properly then just download plantuml2mysql.py to appropriate location and run as any other Python script.

Future

I just satisfied with this code as is but new features and fixes are welcome. Code is public domain.

Thank for contributions:

  • Benoît Bailleux for a lot of features.

Mentions

Similar tools

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].