Use schemacrawler to generate Mermaid diagram
Published: 2021-06-13 11:40:33

<sub>Photo by <a href="https://unsplash.com/@pinadventuremap">Pin Adventure Map</a> on <a href="https://unsplash.com/s/photos/cartography">Unsplash</a></sub>

Mermaid is a fantastic tool to document your database. I discover you can use it to generate Mermaid diagram.

### Database
#### Schemacrawler

- [schemacrawler website](https://www.schemacrawler.com/)
- [Katacoda learning scenario](https://www.katacoda.com/schemacrawler)
- [How to generate Mermaid Diagram with schemcrawler](https://dev.to/sualeh/how-to-generate-mermaid-diagrams-for-your-database-33bn) to generate diagram like [this one](https://mermaid-js.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoiZXJEaWFncmFtXG5cbiAgYXJ0aXN0cyB7XG4gICAgSU5URUdFUiBBcnRpc3RJZFxuICAgIE5WQVJDSEFSIE5hbWVcbiAgfVxuXG4gIGVtcGxveWVlcyB7XG4gICAgSU5URUdFUiBFbXBsb3llZUlkXG4gICAgTlZBUkNIQVIgTGFzdE5hbWVcbiAgICBOVkFSQ0hBUiBGaXJzdE5hbWVcbiAgICBOVkFSQ0hBUiBUaXRsZVxuICAgIElOVEVHRVIgUmVwb3J0c1RvXG4gICAgREFURVRJTUUgQmlydGhEYXRlXG4gICAgREFURVRJTUUgSGlyZURhdGVcbiAgICBOVkFSQ0hBUiBBZGRyZXNzXG4gICAgTlZBUkNIQVIgQ2l0eVxuICAgIE5WQVJDSEFSIFN0YXRlXG4gICAgTlZBUkNIQVIgQ291bnRyeVxuICAgIE5WQVJDSEFSIFBvc3RhbENvZGVcbiAgICBOVkFSQ0hBUiBQaG9uZVxuICAgIE5WQVJDSEFSIEZheFxuICAgIE5WQVJDSEFSIEVtYWlsXG4gIH1cblxuICBnZW5yZXMge1xuICAgIElOVEVHRVIgR2VucmVJZFxuICAgIE5WQVJDSEFSIE5hbWVcbiAgfVxuXG4gIG1lZGlhX3R5cGVzIHtcbiAgICBJTlRFR0VSIE1lZGlhVHlwZUlkXG4gICAgTlZBUkNIQVIgTmFtZVx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