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.

The Schema Documentation dialog with the title Shop Database, the format HTML5 and the content options

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.

  1. Open the diagram you want to document.
  2. Choose File → Export As... → HTML5/PDF Documentation, or press Ctrl+D.
  3. Type a Title. It shows at the top of the documentation.
  4. Choose the format: HTML5, PDF or Markdown.
  5. Under File Path, type the file name, or press ... to choose it.
  6. 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 .svg file. 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.
The customers table in the HTML5 documentation: its comment, its columns with icons, data types and constraints, its indexes and the foreign keys that reference it

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.

The icon legend of the HTML5 documentation: primary key, unique, index, foreign key, referenced by, mandatory
IconMeaning
KeyThe column belongs to the primary key.
FingerprintThe column belongs to a unique index or a unique key.
Magnifying glassThe column belongs to an index.
Arrow pointing up and right, on a small plateA 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 plateReferenced by: a column of another table points to this column.
Red asteriskMandatory: the column cannot be empty (NOT NULL).
Speech bubble after the nameThe 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.

The tables addresses, customers, orders and order_items on the diagram, with key, fingerprint, magnifier, foreign key and comment icons

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.

  1. Double-click the table header on the diagram.
  2. Type the table's description in the Comment box above the tabs.
  3. 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.

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.

  1. Choose Edit → Settings.
  2. In the General tab, open HTML/PDF Documentation.
  3. Type your text in Logo Text. Write DATE where the export date should go.
  4. In Logo Href, type the address the text links to.
  5. 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.
  6. Press OK.
  7. In the documentation dialog, tick Legend.
The HTML/PDF Documentation settings with Logo, Logo Icon, Logo Text set to Shop Inc. DATE, Logo Href and Show Mouse Hover Tip

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:

  1. The title and a "Generated using DbSchema" line.
  2. With several diagrams, a numbered list of them, and Prev, Index and Next links on each.
  3. With Table of Contents ticked, a numbered list of the tables, with links.
  4. For each diagram, its image.
  5. For each table, a heading, its comment, and a table of its columns with Idx, Name, Data Type and, where comments exist, Description.
  6. Under each table, Indexes, Foreign Keys, Constraints and Triggers where it has any.
  7. 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 |
|---|---|---|---|
| * &#128273;  &#11019; | customer\_id| integer  DEFAULT nextval('shop.customers_customer_id_seq'::regclass) |  |
| * | first\_name| varchar(60)  |  |
| * &#128269; | email| varchar(120)  | Login and contact address, unique per customer |

##### Indexes
|Type |Name |On |
|---|---|---|
| &#128273;  | customers\_pkey | ON customer\_id|
| &#128269;  | customers\_email\_key | ON email|

The symbols are written as HTML codes, such as &#128273;. 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 as 1, 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.

Next steps