Skip to content

feat(plugins): #1038 PR A - data layer for sidebar grouping - #1202

Merged
datlechin merged 5 commits into
mainfrom
feat/1038-data-layer
May 11, 2026
Merged

datlechin merged 5 commits into
mainfrom
feat/1038-data-layer

Conversation

@datlechin

Copy link
Copy Markdown
Member

Scope

Foundation for issue #1038 (sidebar grouping by object kind). Data layer only — no UI changes. PR B will render against this.

PRD: [/tmp/issue-1038/prd/PRD-sidebar-grouping.md] (local), tracking issue #1038.

Changes

  • TableInfo.TableType: add .materializedView = "MATERIALIZED VIEW" and .foreignTable = "FOREIGN TABLE". Update QuickSwitcherViewModel (only exhaustive switch on TableType) to handle new cases, mapping matviews to view bucket and foreign tables to table bucket as interim until PR B introduces dedicated kinds.
  • PluginDriverAdapter.fetchTables: map "materialized view"/"materialized_view" to .materializedView and "foreign table"/"foreign_table" to .foreignTable. Existing case-insensitive matching and unknown-type warning logging preserved.
  • PostgreSQL plugin: adopt PluginProcedureFunctionSupport via +Routines.swift extension. Implements fetchProcedures/fetchFunctions via information_schema.routines and fetchProcedureDDL/fetchFunctionDDL via pg_get_functiondef. Extends fetchTables to UNION pg_matviews and pg_foreign_table with explicit type strings. Capability flags add .materializedViews, .foreignTables, .storedProcedures, .userFunctions.
  • MySQL plugin: adopt PluginProcedureFunctionSupport via +Routines.swift extension. Uses information_schema.routines filtered by routine_schema = DATABASE() and SHOW CREATE PROCEDURE/FUNCTION for DDL. Capabilities add .storedProcedures, .userFunctions.

No ABI bump

currentPluginKitVersion stays at 11. Both changes are additive:

  • New PluginCapabilities flags already exist in PluginKit (lines 10–13 of PluginCapabilities.swift); plugins opt in by declaring them.
  • PluginProcedureFunctionSupport is a separate sub-protocol that plugins downcast to. Existing plugins without it continue to work; new methods are not requirements on PluginDatabaseDriver.

Capability matrix added in this PR

Plugin Tables Views Matview Foreign Procs Funcs
PostgreSQL yes yes yes yes yes yes
MySQL yes yes - - yes yes

Other plugins unchanged (PR C will roll out Oracle, MSSQL, DuckDB, ClickHouse, etc.).

Test plan

  • swiftlint --strict clean on all changed files
  • xcodebuild build succeeds
  • New unit tests PluginDriverAdapterTableTypeMappingTests (10 tests) cover TABLE/BASE TABLE/PREFIX/VIEW/MATERIALIZED VIEW/materialized_view/FOREIGN TABLE/foreign_table/SYSTEM TABLE variants, case-insensitive matching, unknown-type fallback, and raw-value round trip
  • Existing PluginDriverAdapterTableOpsTests still pass
  • Manual: connect to Postgres with a matview + foreign table + procedure + function and confirm fetchTables returns them with correct types and PluginProcedureFunctionSupport downcast yields the routines (deferred to PR B integration)
  • Manual: MySQL connection with a stored procedure and function; confirm same (deferred to PR B integration)

@datlechin
datlechin merged commit e11dce8 into main May 11, 2026
2 checks passed
@datlechin
datlechin deleted the feat/1038-data-layer branch May 11, 2026 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant