Schema Documentation
DbSchema writes documentation of your database schema as an HTML5 page, a PDF or a Markdown file. The documentation holds the diagram and a description of every table, column, index and foreign key. Share it with people who never open DbSchema.
Exporting documentation needs DbSchema Pro. It reads the model only: neither the model nor the database changes.
Generate the documentation
Do this when someone needs to read the schema without DbSchema, or before a review.
- Open the diagram you want to document.
- Choose File → Export As... → HTML5/PDF Documentation, or press Ctrl+D.
- Type a Title. It shows at the top of the documentation.
- Choose the format: HTML5, PDF or Markdown.
- Under File Path, type the file name, or press ... to choose it.
- Press Generate.
With Preview in Browser ticked, DbSchema opens the HTML5 page or the PDF when it is ready.
Choose what goes in
The Content part of the dialog decides what the documentation holds.
- Current Diagram, Selected Diagram, Open Diagrams or Diagrams with 'documentation' tag: which diagrams to document. See Document several diagrams.
- Text Documentation: a description of each table, with its columns.
- Diagram Vector Image: the diagram as an image that stays sharp when you zoom.
- Image Mouse-Over Tooltips: the comments of tables and columns show when you point at them in the diagram image.
- Table of Contents: a list of the tables, with links. In HTML5 it fills the sidebar.
- Legend: a box in the diagram image with the title, your logo and your company text.
- All Columns: every column. Untick it to document only the columns the diagram shows.
- Indexes, Foreign Keys, View Query, Triggers, Functions and Procedures, Procs/Triggers Text, Sequences, User Data Type: the other schema objects to describe.
The Settings part changes how the result looks:
- Dark Theme: a dark HTML5 page. PDF stays light.
- Full-Size Diagrams: the HTML5 page uses the whole browser window, and each diagram keeps its drawn size. Drag a diagram to move around in it.
- Use Separate SVG File: the diagram image goes into its own
.svgfile. The links between the image and the text then stop working. - Escape Comments: the characters
<,>and&in your comments show as text instead of being read as HTML.
Read the HTML5 documentation
The HTML5 documentation is a single .html file. Open it in any browser, with no server and no internet connection.
- The top bar shows the title, the database type, the number of tables and the date of the export. Its search box finds tables, columns and comments.
- The sidebar lists the tables, when Table of Contents is ticked. With several diagrams, it lists the diagrams too.
- The diagram card shows the diagram. Drag to pan, and hold Ctrl while you turn the mouse wheel to zoom. Point at a column to read its comment.
- Below the diagram, a card for each table lists its columns with their data types and constraints, then its indexes, its foreign keys and the tables that reference it. Show in diagram jumps to the table in the diagram.
What the icons mean
The same icons mark the columns on the diagram in DbSchema and in the HTML5 documentation. The HTML5 page repeats this legend below the first diagram.
| Icon | Meaning |
|---|---|
| Key | The column belongs to the primary key. |
| Fingerprint | The column belongs to a unique index or a unique key. |
| Magnifying glass | The column belongs to an index. |
| Arrow pointing up and right, on a small plate | A foreign key: the column points to a row in another table. On the diagram, click it to open that table. |
| Arrow pointing down and left, on a small plate | Referenced by: a column of another table points to this column. |
| Red asterisk | Mandatory: the column cannot be empty (NOT NULL). |
| Speech bubble after the name | The column has a comment. Point at the column to read it. |
On the diagram, the icon at the right end of a column without a foreign key shows the kind of data: Σ for numbers, Tт for text, a clock for date and time, and a switch for true or false. A smaller key, fingerprint or magnifying glass marks a column that comes second or later in its index.
Add descriptions to tables and columns
A comment is a short text that explains a table or a column. DbSchema stores it in the model and, when you are connected, in the database.
- Double-click the table header on the diagram.
- Type the table's description in the Comment box above the tabs.
- Press OK.
A column has its own Comment box in the column dialog, as Add a column shows.
The documentation shows each comment under the table name and in the Description column. In the diagram image, the comments show when you point at a table or a column.
Add your company name and logo
The Legend box in the diagram image shows the title, a logo and one line of text. That line says "DbSchema.com © DATE Wise Coders" until you change it.
- Choose Edit → Settings.
- In the General tab, open HTML/PDF Documentation.
- Type your text in Logo Text. Write
DATEwhere the export date should go. - In Logo Href, type the address the text links to.
- To use your own logo, paste SVG code into Logo Icon, without the
<svg>tag. An<image href="data:image/png;base64,..." .../>tag works too. - Press OK.
- In the documentation dialog, tick Legend.
DbSchema replaces DATE with the export date, such as 2026-10-06.
Generate a PDF
Choose PDF when you need a document to print or to attach to an email.
- Page Size sets the paper, from Letter and A4 to A0. Tick Landscape to turn the page.
- If your names or comments use Cyrillic, Arabic, Chinese or other non-Latin letters, tick Embed Unicode Font. The PDF then carries the font and grows by about 15 MB.
- The setting PDF Comments as Mouse-Over Tooltips, in Edit → Settings → HTML/PDF Documentation, adds the comments to the diagram as PDF notes.
Generate Markdown
Choose Markdown to keep the documentation next to your code, for example in a Git repository or a wiki.
DbSchema writes a .md file and, for each diagram, an .svg image of it.
With one diagram, the image sits next to the .md file. With several diagrams, the images go into a folder named after the .md file.
The Markdown file holds, in this order:
- The title and a "Generated using DbSchema" line.
- With several diagrams, a numbered list of them, and Prev, Index and Next links on each.
- With Table of Contents ticked, a numbered list of the tables, with links.
- For each diagram, its image.
- For each table, a heading, its comment, and a table of its columns with Idx, Name, Data Type and, where comments exist, Description.
- Under each table, Indexes, Foreign Keys, Constraints and Triggers where it has any.
- For each view, its query and its columns. Then functions, procedures and sequences, where you ticked them.
The Idx column marks each column with a symbol: * mandatory, 🔑 primary key, 🔍 unique, 🔎 index, ⬈ foreign key, ⬋ referenced by.
A part of the result for the shop database:
### Table shop.customers
Everyone who created an account
|Idx |Name |Data Type |Description |
|---|---|---|---|
| * 🔑 ⬋ | customer\_id| integer DEFAULT nextval('shop.customers_customer_id_seq'::regclass) | |
| * | first\_name| varchar(60) | |
| * 🔍 | email| varchar(120) | Login and contact address, unique per customer |
##### Indexes
|Type |Name |On |
|---|---|---|
| 🔑 | customers\_pkey | ON customer\_id|
| 🔍 | customers\_email\_key | ON email|
The symbols are written as HTML codes, such as 🔑. GitHub and most wikis show them as the icons above.
Document several diagrams
Each diagram becomes one section of the documentation. Split a large schema into diagrams by topic, such as customers, orders and products, and the documentation follows the same topics.
In the documentation dialog, the first list under Content picks the diagrams:
- Current Diagram: the diagram you have open.
- Selected Diagram: the diagrams you tick in the list next to it.
- Open Diagrams: every diagram open in a tab.
- Diagrams with 'documentation' tag: every diagram that carries the tag
documentation. The tag's value sets the order, so give them values such as1,2,3.
To tag a diagram, choose Diagram → Diagram Properties and add the tag documentation in the tags tab beside the comment.
Generate documentation from a script
To refresh the documentation automatically, for example every night, generate it with a Groovy script. The link Automate using Java Groovy scripts in the dialog opens the Automation Scripts page, which has examples.
Common problems
What do the magnifying glasses mean?
A magnifying glass marks a column that belongs to an index. A fingerprint marks a unique index. See What the icons mean.
My company name and the date do not show
The company text shows only in the Legend box of the diagram image.
Tick Legend in the documentation dialog, and set Logo Text in Edit → Settings → HTML/PDF Documentation, as Add your company name and logo shows.
Write DATE in the text for the export date.
The HTML5 page has no sidebar
Tick Table of Contents and Text Documentation. The sidebar then lists the tables, even for a single diagram.
The diagram image says "DbSchema Trial"
DbSchema marks the diagram image this way during the trial, and when no Pro license is active. Register a Pro license and generate the documentation again.
Generate shows an error with the file path
The folder in File Path must exist. DbSchema creates the file, not the folder.