A tool to generate Markdown documentation for database table structures.
language
-
Download the jar file and include it in your project.
-
Execute the following in your project:
// Data source configuration DbSourceConfig sourceConfig = DbSourceConfig.builder() .jdbcUrl("jdbc:postgresql://ip:5432/x") .password("123456") .driverClassName("org.postgresql.Driver") .username("postgres").build(); // Execute the generation, default output is in the root directory of the project MarkdownUtil.db2md(sourceConfig);
This project supports customizing the properties and display names of the exported columns. Simply customize
List<MdColumnItem>.
DbSourceConfig sourceConfig = DbSourceConfig.builder() .jdbcUrl("jdbc:postgresql://ip:5432/x") .password("123456") .driverClassName("org.postgresql.Driver") .username("postgres").build(); public static final List<MdColumnItem> DEFAULT_COLUMN_ITEMS = List.of( MdColumnItem.of("Name", "COLUMN_NAME"), MdColumnItem.of("Data Type", "TYPE_NAME"), MdColumnItem.of("Column Size", "COLUMN_SIZE"), MdColumnItem.of("Nullable", "IS_NULLABLE"), MdColumnItem.of("Default Value", "COLUMN_DEF"), MdColumnItem.of("Remarks", "REMARKS") ); MarkdownUtil.db2md(sourceConfig, MdColumnConfig.DEFAULT_TABLE_CONFIG, colItems);
| Schema | Table | Description |
|---|---|---|
| public | demo1 | Sample Table 1 |
| public | demo2 | Sample Table 2 |
| Name | Data Type | Column Size | Nullable | Default Value | Remarks |
|---|---|---|---|---|---|
| id | uuid | 2147483647 | NO | Primary Key | |
| name | varchar | 255 | YES | Name | |
| created_date | date | 13 | YES | Creation Date | |
| deleted | bool | 1 | YES | false | Deleted Flag |
| Name | Data Type | Column Size | Nullable | Default Value | Remarks |
|---|---|---|---|---|---|
| id | uuid | 2147483647 | NO | Primary Key | |
| version | int8 | 19 | YES | Version | |
| updated_date | date | 13 | YES | Update Date |