{"id":17962418,"url":"https://github.com/grafov/plantuml2mysql","last_synced_at":"2025-08-03T23:36:04.052Z","repository":{"id":28568414,"uuid":"32086050","full_name":"grafov/plantuml2mysql","owner":"grafov","description":"This utility parses PlantUML class diagram and generates SQL DDL for MySQL","archived":false,"fork":false,"pushed_at":"2020-02-14T18:19:25.000Z","size":29,"stargazers_count":118,"open_issues_count":2,"forks_count":28,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-05T02:22:21.379Z","etag":null,"topics":["database","diagram","plantuml","sql","uml-diagram","utility"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grafov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-12T15:53:43.000Z","updated_at":"2025-03-08T15:19:35.000Z","dependencies_parsed_at":"2022-09-15T04:01:02.136Z","dependency_job_id":null,"html_url":"https://github.com/grafov/plantuml2mysql","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/grafov/plantuml2mysql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafov%2Fplantuml2mysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafov%2Fplantuml2mysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafov%2Fplantuml2mysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafov%2Fplantuml2mysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grafov","download_url":"https://codeload.github.com/grafov/plantuml2mysql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafov%2Fplantuml2mysql/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266195242,"owners_count":23891158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","diagram","plantuml","sql","uml-diagram","utility"],"created_at":"2024-10-29T11:19:20.632Z","updated_at":"2025-07-20T20:37:04.119Z","avatar_url":"https://github.com/grafov.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# plantuml2mysql\n\nI liked [plantuml](http://plantuml.com/) tool for UML diagrams but use it\nalso for visualizing structure of relational database.\nThis script loads plantuml class diagram and generates\nDDL for MySQL SQL dialect. You may define primary keys\nwith `#` prefix in field name (it means protected field\nin PlantUML) and define index fields with `+` (public field\nin PlantUML) prefix.\n\nField type noted after field name as is. Also you may\nuse comments after `--`.\n\nFor example class definition:\n\n    @startuml\n\n    class dummy {\n      Sample table.\n      ==\n      #id int(10) -- A comment\n      field1 int(10)\n      .. Comment line, ignored ..\n      field2 varchar(128)\n    }\n\n    @enduml\n\nwill be converted to SQL:\n\n    CREATE TABLE IF NOT EXISTS `dummy` (\n      id               INT(10) COMMENT 'A comment',\n      field1           INT(10),\n      field2           VARCHAR(128),\n      PRIMARY KEY (id));\n\nText between class name and `==` is table description.\nThe description of the table is mandatory.\nI was too lazy to check for absence of descriptions but\nnot lazy to write them in each table of my databases.\n\nA line starting with `..` or `__`, used as a separator\ninto a class definition, will be ignored.\n\nThe HTML markup in comments (after `--`) is stripped.\n\nSee below the result of a more complicated sample from [database.plu](database.plu):\n\n![database.png](database.png)\n\n```bash\n    ./plantuml2mysql.py database.plu sampledb\n```\n\n```sql\n    CREATE DATABASE sampledb CHARACTER SET = utf8 COLLATE = utf8_unicode_ci;\n    USE sampledb;                                                           \n                                                                            \n    CREATE TABLE IF NOT EXISTS `user` (                                       \n      id               SERIAL,                                              \n      login            VARCHAR(16),                                         \n      mail             VARCHAR(64),                                         \n      docsRef          INT(10) COMMENT 'referenced docs for a user',        \n      created          INT(11),                                             \n      sesid            INT(11),                                             \n      PRIMARY KEY (id),                                                     \n      INDEX (login),                                                        \n      INDEX (mail)                                                          \n    );                                                                      \n                                                                            \n    CREATE TABLE IF NOT EXISTS `session` (                                    \n      id               SERIAL,                                              \n      uid              INT(10) UNSIGNED,                                    \n      remoteip         INT(10) UNSIGNED,                                    \n      useragent        VARCHAR(255),                                        \n      data             LONGTEXT COMMENT 'serialized session data',          \n      lastseen         INT(11),                                             \n      PRIMARY KEY (id),                                                     \n      INDEX (uid),                                                          \n      INDEX (lastseen)                                                      \n    );                                                                      \n                                                                            \n    CREATE TABLE IF NOT EXISTS `docs` (                                       \n      id               INT(10),                                             \n      fid              INT(10) COMMENT 'link to a file',                    \n      aunthorid        INT(10),                                             \n      created          INT(11),                                             \n      PRIMARY KEY (id, fid),                                                \n      INDEX (aunthorid),                                                    \n      INDEX (created)                                                       \n    );                                                                      \n                                                                            \n    CREATE TABLE IF NOT EXISTS `files` (                                      \n      id               SERIAL,                                              \n      docId            INT(10),                                             \n      title            VARCHAR(255),                                        \n      path             VARCHAR(255),                                        \n      hash             INT(32) UNSIGNED,                                    \n      PRIMARY KEY (id),                                                     \n      INDEX (docId)                                                         \n    );                                                                      \n```\n\n# Installation\n\nThe script not uses external dependencies. If you have installed Python 3\nproperly then just download `plantuml2mysql.py` to appropriate location and\nrun as any other Python script.\n\n# Future\n\nI just satisfied with this code as is but new features and fixes are welcome.\nCode is public domain.\n\nThank for contributions: \n\n* Benoît Bailleux for a lot of features.\n\n# Mentions\n\n* [An ecosystem of tools around PlantUML to render textual UML diagrams anywhere you want](https://modeling-languages.com/plantuml-textual-uml-online/)\n\n# Similar tools\n\n* [github.com/achiku/planter](https://github.com/achiku/planter) — generate ER diagrams from PostgreSQL tables\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafov%2Fplantuml2mysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrafov%2Fplantuml2mysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafov%2Fplantuml2mysql/lists"}