Skip to content

refactor(connections): unify schema tree building across Postgres, MySQL and SDUI drivers #1505

Open

Description

@ZhuchkaTriplesix

Problem

In lib/features/connections/, schema tree rendering for database objects has evolved into separate massive implementations:

  • connections_panel_pg_tree.dart (959 lines)
  • connections_panel_mysql.dart (782 lines)
  • Meanwhile, extension drivers use a declarative Server-Driven UI model (sdui_tree_builder.dart).

Both Postgres and MySQL tree files implement almost identical boilerplate:

  1. Recursive node expansion / collapse tracking.
  2. Async lazy-loading spinners and error retry handling.
  3. Node context menu creation (query, copy name, refresh, drop).
  4. Schema object icon caching and indent guide rendering.

This duplication inflates bundle size, leads to inconsistent UI behavior across engines, and increases maintenance costs when adding new database features.

Scope

  • Extract a unified DatabaseTreeNode / SchemaTreeAdapter abstraction in features/connections/.
  • Consolidate node lazy-loading, expansion state, error banners, and context menu rendering into a shared tree controller.
  • Refactor PostgreSQL and MySQL trees to supply metadata definitions to the common tree adapter instead of implementing distinct widget trees from scratch.

Acceptance

  • connections_panel_pg_tree.dart and connections_panel_mysql.dart reduced by at least 50% in line count.
  • Unified node interaction and context menu behavior across all database drivers.
  • Schema tree regression tests remain green.

Activity

  1. added
    frontendTheme parser epic label: frontend
    uiUser interface components and widgets
    connectionsDatabase connections, URI parsing, pools
    P3Low priority / Polish & Enhancements
    on Oct 12, 2026
  2. added this to the 0.5.0 milestone on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low priority / Polish & EnhancementsconnectionsDatabase connections, URI parsing, poolsfrontendTheme parser epic label: frontenduiUser interface components and widgets

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions