Database diagrams
Last modified: 11 February 2024In the Database tool window, right-click a database object and select Diagrams | Show Diagram
Enable the Database Tools and SQL plugin
This functionality relies on the Database Tools and SQL plugin, which is bundled and enabled in IntelliJ IDEA by default. If the relevant features aren't available, make sure that you didn't disable the plugin.
note
The Database Tools and SQL plugin is available only in IntelliJ IDEA Ultimate.
Press to open the IDE settings and then select Plugins.
Open the Installed tab, find the Database Tools and SQL plugin, and select the checkbox next to the plugin name.
Enable the Diagrams plugin
This functionality relies on the Diagrams plugin, which is bundled and enabled in IntelliJ IDEA by default. If the relevant features aren't available, make sure that you didn't disable the plugin.
Press to open the IDE settings and then select Plugins.
Open the Installed tab, find the Diagrams plugin, and select the checkbox next to the plugin name.
Database diagrams graphically show the structure of the database and relations between database objects. You can generate a diagram for a data source, a schema, or a table. To create relations between database objects, consider using primary and foreign keys.
You can save the generated diagrams in two formats: UML and PNG. The UML format is an internal format developed specifically for IntelliJ IDEA. It is not supported by other products. If you want to share the created diagram, consider using PNG.
Also, you can build execution plans. An execution plan is a set of steps that were used to access data in a database. For more information about creating an execution plan, refer to Visualize a query plan.
Generate a diagram for a database object
In the Database tool window ( View | Tool Windows | Database) , right-click a database object and select Diagrams | Show Diagram.

View and manage diagrams
Pan and zoom
To pan and zoom the diagram, use your touchpad, scroll bars or the mouse wheel for vertical scrolling and + mouse wheel for horizontal scrolling. You can also use + mouse wheel for zooming.
To use the magnifier tool, keep the key pressed, and hover over the desired areas of the diagram. Use the mouse wheel to extra zoom the diagram area within magnifier tool.
Enable column comments
Generate a diagram. For more information about generating a diagram, refer to Generate a diagram for a database object.
Click the Comments button (
).
Apply colors to diagram objects
In the Database tool window ( View | Tool Windows | Database) , right-click an object and select Tools | Set Color.
Select a color and click OK. Refresh the diagram to apply the color by clicking the Refresh button ().
Export diagrams
In IntelliJ IDEA, you can export a diagram in various formats to file, to clipboard, and open it in a web editor. You can also print a diagram and save it as an image. To do that, use the corresponding actions in the context menu of your diagram. For more information about the database diagram context menu, refer to Context menu.
Open diagrams in web editors
To export your diagram to a third-party editor in web browser, right-click the diagram, navigate to Export Diagram | Open in Web Editor, and select the editor.
Alternatively, click the Export Diagram button (
) on the diagram toolbar, and select the editor in the corresponding submenu.
The supported editors are as follows:
Copy diagrams to clipboard
To copy your diagram to clipboard, right-click the diagram, navigate to Export Diagram | Copy to Clipboard, and select the format.
Alternatively, click the Export Diagram button (
) on the diagram toolbar, and select the format in the corresponding submenu.
The supported formats are as follows:
Mermaid
classDiagram
{...}PlantUML
@startuml
{...}Graphviz DOT
digraph "sakila" {
{...}Graphviz DOT with Positions
digraph "sakila" {
{...}
Export diagrams to files
To export your diagram to a file, right-click the diagram, navigate to Export Diagram | Export to File, and select the format.
Alternatively, click the Export Diagram button (
) on the diagram toolbar, and select the format in the corresponding submenu.
The supported formats are as follows:
YEd .graphml
JGraph .drawio
Graphviz .dot
Graphviz .dot with Positions
Mermaid .md
PlantUML
IDEA .uml: The UML format
is an internal format supported only by IntelliJ IDEA. To open the saved diagram, drag the UML file to the editor.
Export diagrams as images in PNG format
To export your diagram as an image in PNG format, right-click the diagram and select Export Diagram | Export to Image.
Alternatively, click the Export Diagram button (
) on the diagram toolbar, and select Export to Image.
Reference
Icons
Possible icon combinations for columns in diagrams:
Icon | Foreign key | Primary key | Indexed | NOT NULL |
---|---|---|---|---|
Diagram configuration settings
To configure the default visibility settings and layout for diagrams, open settings by pressing and navigate to Tools | Diagrams.
For more information about database diagrams configuration settings, refer to the Diagrams reference topic.

Toolbar and context menu
For more information about database diagrams toolbar and context menu, refer to the Diagram toolbar and context menu reference topic.
