Skip to content

feat(export): DBML and PDF export of the diagram (#1285) - #1297

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/1285-erd-dbml-pdf-export
Oct 10, 2026
Merged

ZhuchkaTriplesix merged 1 commit into
devfrom
issue/1285-erd-dbml-pdf-export

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Closes #1285

Last issue of the ERD epic #1286.

DBML (Export → DBML (.dbml), Copy DBML)

  • Table "t" [headercolor: #…, note: '…'] with columns pk, increment, not null, unique, default, note; a composite primary key goes in an indexes { (a, b) [pk] } block.
  • Types that are not one word are quoted ("timestamp with time zone"); defaults map to number / boolean / 'string' (a ::cast dropped) / `expression`.
  • Enum for enum columns (PostgreSQL labels, MySQL enum(...)).
  • Ref: with - for a one-to-one foreign key and > otherwise; schema tables as "schema"."table".
  • TableGroup for the user's groups, sticky notes as Note. Only the tables the diagram shows.

PDF (Export → PDF (A4) / PDF (A3))

  • The SVG export, fitted on one page (landscape when the diagram is wider than tall), centred in a 28 pt margin, as a ~200 dpi image (longest side capped at 4096 px). Same palette rule as SVG: light, or the current theme when that setting is on.
  • Written by hand (lib/core/export/image_pdf.dart): catalog, page, one Flate image, content stream, xref. No new dependency.

Tests: test/core/erd/erd_dbml_test.dart (golden text of a sample schema and edge cases), test/core/export/image_pdf_test.dart (page plan, xref offsets), and a menu test that saves a DBML and a PDF.

- DBML: tables with pk / increment / not null / unique / default / note,
  composite keys in an indexes block, enums, refs (- for one-to-one, >
  otherwise), table groups, sticky notes and header colours; to a file or
  the clipboard.
- PDF: the diagram as the SVG shows it, fitted on one A4 or A3 page
  (landscape for a wide diagram) as a ~200 dpi image; written by hand,
  no new dependency.
@github-actions github-actions Bot added enhancement New feature or request frontend Theme parser epic label: frontend P3 Low priority / Polish & Enhancements labels Oct 10, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 9ccf2b6 into dev Oct 10, 2026
15 checks passed
@ZhuchkaTriplesix
ZhuchkaTriplesix deleted the issue/1285-erd-dbml-pdf-export branch October 11, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request frontend Theme parser epic label: frontend P3 Low priority / Polish & Enhancements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant