A Gradle plugin to automatically generate Entity-Relationship (ER) diagrams in Mermaid format from Android Room database schema JSON files.
- Generates ER diagrams in Mermaid syntax based on Room schema JSON files.
- Outputs diagrams embedded in Markdown files, making it easy to review schema relationships and manage database changes over time.
When schema JSON files like sample/schemas exist, you can generate Markdown(Mermaid Syntax) documents like sample/schemas-docs.
- Android Room configured to export schemas.
- Gradle 7.x or higher.
- Add the plugin to your
build.gradle.kts:
plugins {
id("jp.ntsk.room-schema-docs") version "1.4.0"
}- Ensure Room's schema export is enabled by adding the following to your
build.gradle.kts:
room {
schemaDirectory("$projectDir/schemas")
}- Configure the plugin in your
build.gradle.kts:
roomSchemaDocs {
schemaDirectory("$projectDir/schemas")
outputDirectory("$projectDir/schemas-docs")
}After setting up, run the following command to generate ER diagrams:
./gradlew generateRoomSchemaDocsFor a directory structure like:
schemas/
├── <YOUR_PACKAGE_NAME>/
│ └── 1.json
The plugin will generate:
schemas-docs/
├── <YOUR_PACKAGE_NAME>/
│ └── 1.md