Skip to content

feat(erd): column markers for unique, not null, default and identity (#1277) - #1289

Merged
ZhuchkaTriplesix merged 3 commits into
devfrom
issue/1277-erd-column-markers
Oct 10, 2026
Merged

ZhuchkaTriplesix merged 3 commits into
devfrom
issue/1277-erd-column-markers

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Summary

Third issue of the ERD epic (#1286). A column showed only PK / FK; now it says what dbdiagram shows.

Catalog (ErdColumn gets isUnique, defaultValue, isIdentity):

unique default identity
PostgreSQL single-column unique index, not the PK pg_attrdef attidentity, or a nextval() default (serial)
MySQL column_key = 'UNI' column_default extra has auto_increment
SQLite single-column unique index (pragma_index_list) dflt_value INTEGER PRIMARY KEY (the rowid alias)

Old four- and five-column catalog rows still read, so fakes and callers that do not ask for the new columns keep working.

Card: UQ / AI / DF after the type; nullable keeps its ?. The row's tooltip lists every fact, one a line (Default: 'new', Not null, Unique, ...). The card is measured with the markers; the SVG / PNG export prints them after the type.

MCP: describe_table reports unique, identity and default.

Not done: composite unique constraints (only single-column ones count as "unique"); MySQL marks UNI on the first column of a multi-column unique index too.

Tests: catalog rows with and without the new columns; each dialect's SQL asks for them; the real SQLite catalog (through the MCP read-only session) reports unique, default and identity; a card shows the markers and the tooltip lists them.

Closes #1277

Test plan

  • CI: all test sections pass, including the real SQLite catalog test (no local runs, per team rule)
  • By hand on PostgreSQL and MySQL: a serial / identity id, a unique email, a column with a default

…1277)

ErdColumn gets isUnique, defaultValue and isIdentity, read by the catalog
query of each dialect:
- PostgreSQL: single-column unique indexes (not the PK), pg_attrdef
  defaults, attidentity or a nextval() default;
- MySQL: column_key UNI, column_default, extra auto_increment;
- SQLite: single-column unique indexes from pragma_index_list, dflt_value,
  INTEGER PRIMARY KEY (the rowid alias).

A card row shows UQ / AI / DF after the type (nullable keeps its ?), its
tooltip lists every fact one a line, the card is measured with them, and the
SVG export prints them too. MCP describe_table reports unique, identity and
default.
@github-actions github-actions Bot added enhancement New feature or request frontend Theme parser epic label: frontend core Core library logic and services P2 Medium priority / Parity & Refactoring labels Oct 10, 2026
…ique

Checked on a live database through MCP: user_specialties.user_id has
'UNIQUE (user_id) WHERE is_primary', one primary specialty per user, and was
shown as unique. Only indexes without a predicate count now.
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit d0df6fc into dev Oct 10, 2026
15 checks passed
@ZhuchkaTriplesix
ZhuchkaTriplesix deleted the issue/1277-erd-column-markers 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

core Core library logic and services enhancement New feature or request frontend Theme parser epic label: frontend P2 Medium priority / Parity & Refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant