A Python script to generate documentation from MySQL Workbench ERR diagram. This README file is adpated based on the README.md from [this repository](https://github.com/letrunghieu/mysql-workbench-plugin-doc-generating/releases/tag/1.0.2)(retrieved on Apriil 16, 2021). The codes in mysql-workbench-plugin-doc-generating.py is slightly adjusted.
## Installation
* Open the MySQL Workbench
* Navigate to menu **Scripting** > **Install Plugin/Module...**
* Browse and select the extracted `mysql-workbench-plugin-doc-generating.py` file in this folder
* Restart the Workbench
## Usage
An example output of the Nexus-e database can be found at [nexus-e-database.md](nexus-e-database.md).
### Generate documentation from ERR digram
* Open the ERR digram
* Navigate to menu **Tools** > **Utilities** > **Generate Documentation (Markdown)**
* When you see the status bar text changed to *Documentation generated into the clipboard. Paste it to your editor.*, Paste (<kbd>Ctrl</kbd> + <kbd>V</kbd> in most Linux/Window applications) to your editor and save as a new file.
* Name the new file as `nexus-e-database.md` and store it in the folder **docs/sources**.
### Generate ERR digram from physical database
In case that you do not have the ERR diagram, you have to create a diagram from your physical database first. Don't worry, MySQL Workbench has a greate tool to do this for you called **Reverse Engineer**.
* Open Workbench
* Navigate to menu **Database** > **Reverse Engineer...**
* Choose the connection, **Next**
* Wait and **Next**
* Select the datbase you want to create ERR diagram from, **Next**
* Wait and **Next**
* Select tables that you want to include in the ERR diagram, **Execute>**
* Wait and **Next**
***Finish**
You have a new ERR diagram, you can generate the documentation from this diagram as the previous step.
After that, you can convert the output Markdown document into any format that you want.
text+=("<br /><br />"ifcolumn.commentelse"")+"**foreign key** to column `"+fk.referencedColumns[0].name+"` on table `"+fk.referencedColumns[0].owner.name+"`."
Generated by [MySQL Workbench Model Documentation plugin](https://github.com/letrunghieu/mysql-workbench-plugin-doc-generating) - Copyright (c) 2015 Hieu Le
## Table: `DBinfo`
### Description:
### Columns:
| Column | Data type | Attributes | Default | Description |
| --- | --- | --- | --- | --- |
| `Date` | VARCHAR(25) | Not null | | |
| `Excel_file_used` | VARCHAR(150) | Not null | | |
| `Matlab_file_used` | VARCHAR(150) | Not null | | |
| `created_by_user` | VARCHAR(100) | Not null | | |
| `Schema_version` | DOUBLE | Not null | | |
| `notes` | TEXT | | `NULL` | |
## Table: `busconfiguration`
### Description:
### Columns:
| Column | Data type | Attributes | Default | Description |
| --- | --- | --- | --- | --- |
| `idNetworkConfig` | INT | PRIMARY, Not null | | **foreign key** to column `idNetworkConfig` on table `networkconfiginfo`. |
| `idBus` | INT | PRIMARY, Not null | | **foreign key** to column `idBus` on table `busdata`. |