{"id":21820599,"url":"https://github.com/sue445/plant_erd","last_synced_at":"2025-04-05T06:06:13.420Z","repository":{"id":36522706,"uuid":"223186878","full_name":"sue445/plant_erd","owner":"sue445","description":"ERD exporter with PlantUML and mermaid format","archived":false,"fork":false,"pushed_at":"2025-03-25T09:53:34.000Z","size":555,"stargazers_count":166,"open_issues_count":2,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T05:04:58.419Z","etag":null,"topics":["erd","mermaid","mysql","oracle","plantuml","postgresql","sqlite3"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/sue445/plant_erd","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sue445.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-21T14:00:16.000Z","updated_at":"2025-03-25T09:53:38.000Z","dependencies_parsed_at":"2023-02-13T04:30:34.117Z","dependency_job_id":"0cdc0a7f-1859-4375-b21e-bbb4d0d7ff41","html_url":"https://github.com/sue445/plant_erd","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sue445%2Fplant_erd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sue445%2Fplant_erd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sue445%2Fplant_erd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sue445%2Fplant_erd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sue445","download_url":"https://codeload.github.com/sue445/plant_erd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294538,"owners_count":20915340,"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":["erd","mermaid","mysql","oracle","plantuml","postgresql","sqlite3"],"created_at":"2024-11-27T16:37:54.519Z","updated_at":"2025-04-05T06:06:13.394Z","avatar_url":"https://github.com/sue445.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PlantERD\nERD exporter with [PlantUML](https://plantuml.com/) and [mermaid](https://mermaid-js.github.io/mermaid/) format\n\n[![test](https://github.com/sue445/plant_erd/actions/workflows/test.yml/badge.svg)](https://github.com/sue445/plant_erd/actions/workflows/test.yml)\n[![build](https://github.com/sue445/plant_erd/actions/workflows/build.yml/badge.svg)](https://github.com/sue445/plant_erd/actions/workflows/build.yml)\n[![Coverage Status](https://coveralls.io/repos/github/sue445/plant_erd/badge.svg?branch=master)](https://coveralls.io/github/sue445/plant_erd?branch=master)\n[![Maintainability](https://api.codeclimate.com/v1/badges/0a9432880ae3f992cc65/maintainability)](https://codeclimate.com/github/sue445/plant_erd/maintainability)\n[![Go Report Card](https://goreportcard.com/badge/github.com/sue445/plant_erd)](https://goreportcard.com/report/github.com/sue445/plant_erd)\n\n## Example (PlantUML)\n```bash\n$ ./plant_erd sqlite3 --database /path/to/test_db.sqlite3\n\nentity articles {\n  * id : integer\n  --\n  * user_id : integer\n  --\n  index_user_id_on_articles (user_id)\n}\n\nentity users {\n  * id : integer\n  --\n  name : text\n}\n\narticles }-- users\n```\n\n![example-plantuml](./img/example-plantuml.svg)\n\n## Example (mermaid)\n```bash\n$ ./plant_erd sqlite3 --database /path/to/test_db.sqlite3 --format=mermaid --show-comment\n\nerDiagram\n\narticles {\n  INTEGER id PK\n  INTEGER user_id FK\n}\n\nusers {\n  INTEGER id PK\n  TEXT name\n}\n\nusers ||--o{ articles : owns\n```\n\n```mermaid\nerDiagram\n\narticles {\n  INTEGER id PK\n  INTEGER user_id FK\n}\n\nusers {\n  INTEGER id PK\n  TEXT name\n}\n\nusers ||--o{ articles : owns\n```\n\n## Features\n* Output ERD from real database\n* Output ERD to stdout or file\n* Output only tables within a certain distance adjacent to each other with foreign keys from a specific table\n\n## Supported databases\n* SQLite3\n* MySQL: 5.6, 5.7, 8\n* PostgreSQL: 9, 10, 11, 12, 13, 14, 15\n* Oracle\n\n## Supported output formats\n* [PlantUML](https://plantuml.com/)\n* [mermaid](https://mermaid-js.github.io/mermaid/)\n\n## Setup\nDownload latest binary from https://github.com/sue445/plant_erd/releases and `chmod 755`\n\n* `plant_erd` : for SQLite3, MySQL and PostgreSQL\n* `plant_erd-oracle` : for Oracle\n\n### Setup for `plant_erd-oracle`\n`plant_erd-oracle` requires Basic Package or Basic Light Package in [Oracle Instant Client](https://www.oracle.com/database/technologies/instant-client.html)\n\n#### Example (Linux)\n```bash\nmkdir -p /opt/oracle\nwget --quiet --tries=0 https://download.oracle.com/otn_software/linux/instantclient/193000/instantclient-basiclite-linux.x64-19.3.0.0.0dbru.zip\nunzip -q instantclient-basiclite-linux.x64-19.3.0.0.0dbru.zip -d /opt/oracle\nexport LD_LIBRARY_PATH=/opt/oracle/instantclient_19_3\n\n# for Ubuntu\napt-get update\napt-get install -y libaio1\n```\n\n#### Example (Mac)\nSee https://github.com/kubo/ruby-oci8/blob/master/docs/install-on-osx.md and install `instantclient-basic` or `instantclient-basiclite`\n\n#### Example (Windows)\n1. Go to https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html\n2. Download `instantclient-basic-windows.x64-19.5.0.0.0dbru.zip` or ` instantclient-basiclite-windows.x64-19.5.0.0.0dbru.zip`\n3. Extract zip\n4. Move `plant_erd-oracle` to same directory as `oci.dll`\n\n## Usage\n### SQLite3\n```\n$ ./plant_erd sqlite3 --help\nNAME:\n   plant_erd sqlite3 - Generate ERD from sqlite3\n\nUSAGE:\n   plant_erd sqlite3 [command options] [arguments...]\n\nOPTIONS:\n   -d DISTANCE, --distance DISTANCE  Output only tables within a certain DISTANCE adjacent to each other with foreign keys from a specific table (default: 0)\n   --database DATABASE               SQLite3 DATABASE file\n   -f FILE, --file FILE              FILE for output (default: stdout)\n   --format value                    Output format (plant_uml, mermaid. default:plant_uml)\n   -i, --skip-index                  Whether don't print index to ERD. This option is used only --format=plant_uml\n   -s value, --skip-table value      Skip generating table by using regex patterns\n   --show-comment                    Show column comment. This option is used only --format=mermaid\n   -t TABLE, --table TABLE           Output only tables within a certain distance adjacent to each other with foreign keys from a specific TABLE\n```\n\n### MySQL\n```bash\n$ ./plant_erd mysql --help\nNAME:\n   plant_erd mysql - Generate ERD from mysql\n\nUSAGE:\n   plant_erd mysql [command options] [arguments...]\n\nOPTIONS:\n   --collation COLLATION             MySQL COLLATION (default: \"utf8_general_ci\")\n   -d DISTANCE, --distance DISTANCE  Output only tables within a certain DISTANCE adjacent to each other with foreign keys from a specific table (default: 0)\n   --database DATABASE               MySQL DATABASE name\n   -f FILE, --file FILE              FILE for output (default: stdout)\n   --format value                    Output format (plant_uml, mermaid. default:plant_uml)\n   --host HOST                       MySQL HOST (default: \"localhost\")\n   -i, --skip-index                  Whether don't print index to ERD. This option is used only --format=plant_uml\n   --password PASSWORD               MySQL PASSWORD [$MYSQL_PASSWORD]\n   --port PORT                       MySQL PORT (default: 3306)\n   -s value, --skip-table value      Skip generating table by using regex patterns\n   --show-comment                    Show column comment. This option is used only --format=mermaid\n   -t TABLE, --table TABLE           Output only tables within a certain distance adjacent to each other with foreign keys from a specific TABLE\n   --user USER                       MySQL USER (default: \"root\")\n```\n\n### PostgreSQL\n```bash\n$ ./plant_erd postgresql --help\nNAME:\n   plant_erd postgresql - Generate ERD from PostgreSQL\n\nUSAGE:\n   plant_erd postgresql [command options] [arguments...]\n\nOPTIONS:\n   -d DISTANCE, --distance DISTANCE  Output only tables within a certain DISTANCE adjacent to each other with foreign keys from a specific table (default: 0)\n   --database DATABASE               PostgreSQL DATABASE name\n   -f FILE, --file FILE              FILE for output (default: stdout)\n   --format value                    Output format (plant_uml, mermaid. default:plant_uml)\n   --host HOST                       PostgreSQL HOST (default: \"localhost\")\n   -i, --skip-index                  Whether don't print index to ERD. This option is used only --format=plant_uml\n   --password PASSWORD               PostgreSQL PASSWORD [$POSTGRES_PASSWORD]\n   --port PORT                       PostgreSQL PORT (default: 5432)\n   -s value, --skip-table value      Skip generating table by using regex patterns\n   --show-comment                    Show column comment. This option is used only --format=mermaid\n   --sslmode SSLMODE                 PostgreSQL SSLMODE. c.f. https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS (default: \"disable\")\n   -t TABLE, --table TABLE           Output only tables within a certain distance adjacent to each other with foreign keys from a specific TABLE\n   --user USER                       PostgreSQL USER\n```\n\n### Oracle\n```bash\n$ ./plant_erd-oracle --help\nNAME:\n   plant_erd-oracle - ERD exporter with PlantUML and Mermaid format (for oracle)\n\nUSAGE:\n   plant_erd-oracle [global options] command [command options] [arguments...]\n\nVERSION:\n   vX.X.X (build. xxxxxxx)\n\nCOMMANDS:\n   help, h  Shows a list of commands or help for one command\n\nGLOBAL OPTIONS:\n   -f FILE, --file FILE              FILE for output (default: stdout)\n   -t TABLE, --table TABLE           Output only tables within a certain distance adjacent to each other with foreign keys from a specific TABLE\n   -d DISTANCE, --distance DISTANCE  Output only tables within a certain DISTANCE adjacent to each other with foreign keys from a specific table (default: 0)\n   -i, --skip-index                  Whether don't print index to ERD. This option is used only --format=plant_uml\n   -s value, --skip-table value      Skip generating table by using regex patterns\n   --format value                    Output format (plant_uml, mermaid. default:plant_uml)\n   --show-comment                    Show column comment. This option is used only --format=mermaid\n   --user USER                       Oracle USER\n   --password PASSWORD               Oracle PASSWORD [$ORACLE_PASSWORD]\n   --host HOST                       Oracle HOST (default: \"localhost\")\n   --port PORT                       Oracle PORT (default: 1521)\n   --service SERVICE                 Oracle SERVICE name\n   --help, -h                        show help\n   --version, -v                     print the version\n```\n\n## About `--table` and `--distance`\nWhen `--table` and `--distance` are passed, output only tables within a certain distance adjacent to each other with foreign keys from a specific table.\n\n### Example 1: Output all tables\n```bash\n$ ./plant_erd sqlite3\n```\n\n![example all](img/example-all.svg)\n\n### Example 2: Output only tables within a distance of 1 from the articles\n```bash\n$ ./plant_erd sqlite3 --table articles --distance 1\n```\n\n![example distance 1 from articles](img/example-distance-1-from-articles.svg)\n\n## Testing\n### with all databases\nRun test in container\n\n```bash\ndocker-compose up --build --abort-on-container-exit\n```\n\n### with only SQLite3\nRun test on local\n\n```bash\nmake test\n```\n\n## License\nThe program is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\nBut `plant_erd-oracle` contains [Oracle Instant Client](https://www.oracle.com/database/technologies/instant-client.html).\nOracle Instant Client is under [OTN License](https://www.oracle.com/downloads/licenses/distribution-license.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsue445%2Fplant_erd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsue445%2Fplant_erd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsue445%2Fplant_erd/lists"}