Problem
The ER diagram (#1063, #1145) works only as a tab of the SQL workspace, and its data layer does not fit the table browser:
Scope
ErdSource: loadSchema({String? schema}) and loadNeighbourhood({required ErdTableRef table, int depth = 1}). Implementations for PostgreSQL, MySQL, SQLite on top of a query runner: the SQL workspace delegate for the Diagram tab, the table browser's own read-only session for the table view.
- Schema-aware catalog: the schema / database is passed explicitly.
ErdTable gets schema; a table outside the current schema is labelled schema.table (cards, Mermaid, SVG).
- Neighbourhood: the foreign-key query filtered on the table (either side), repeated up to
depth; then columns only for the tables found. Cycles and self references terminate.
- Availability: the workspace knows whether a diagram source exists; extension SQL workspaces get no Diagram button until an extension can declare one.
ErdView takes an ErdSource instead of the delegate + dialect, plus an optional focusTable (accented card, viewport centred on it).
Acceptance
Problem
The ER diagram (#1063, #1145) works only as a tab of the SQL workspace, and its data layer does not fit the table browser:
ErdViewtakes aSqlExecutionDelegate, i.e. the SQL editor's session. The table browser has its own session on purpose (fix(postgres): do not share the SQL-editor read-write socket with Table Browser #785, fix(sqlite): do not share the SQL-editor Database with Table Browser #794, fix(mysql): do not share the SQL-editor socket with Table Browser #802) and must not borrow the editor's.ErdCatalogreads onlycurrent_schema()(PostgreSQL) /DATABASE()(MySQL). A table in another schema, or a foreign key into another schema, is not shown.ErdTablenames are unqualified.GenericSqlWorkspaceshows Diagram for extension drivers too.ExtensionSqlWorkspacepassesSqlDialect.mysql, so the diagram runs MySQL catalog queries against whatever the extension connects to (e.g. ClickHouse).Scope
ErdSource:loadSchema({String? schema})andloadNeighbourhood({required ErdTableRef table, int depth = 1}). Implementations for PostgreSQL, MySQL, SQLite on top of a query runner: the SQL workspace delegate for the Diagram tab, the table browser's own read-only session for the table view.ErdTablegetsschema; a table outside the current schema is labelledschema.table(cards, Mermaid, SVG).depth; then columns only for the tables found. Cycles and self references terminate.ErdViewtakes anErdSourceinstead of the delegate + dialect, plus an optionalfocusTable(accented card, viewport centred on it).Acceptance
test/features/erd/erd_test.dartpasses (updated only for the schema qualifier).saleswith a FK topublic.customers: the neighbourhood contains both, qualified.