feat(plugins): show table and column comments in sidebar and grid#1782
feat(plugins): show table and column comments in sidebar and grid#1782datlechin wants to merge 2 commits into
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0e3334a86a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| tableRows: TableRows, | ||
| savedLayout: ColumnLayoutState? | ||
| ) { | ||
| let columnComments = AppSettingsManager.shared.general.showObjectComments |
There was a problem hiding this comment.
Include comments in the grid update signature
For the normal editable table path, columnComments are populated later by applyPhase2Metadata, after the first grid render. However, updateNSView only calls reconcileColumnPool when DataGridUpdateSnapshot changes, and that snapshot does not include either tableRows.columnComments or showObjectComments; this line is therefore only evaluated during unrelated structural updates. Opening a MySQL/PostgreSQL table renders header tooltips without the fetched comments, and toggling View > Show Object Comments leaves existing grid tooltips stale until columns/rows or another snapshot field changes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: be2b624975
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| columnDefaults = existing.columnDefaults | ||
| columnForeignKeys = existing.columnForeignKeys | ||
| columnNullable = existing.columnNullable | ||
| columnComments = existing.columnComments |
There was a problem hiding this comment.
Clear comments when schema metadata is absent
When a new result has no parsed schema metadata (for example, after previously displaying a commented table in the same tab and then running SELECT 1 AS id), this copies the prior result's columnComments into the new TableRows. The grid keys header tooltips by column name, so any matching alias inherits a stale comment from the previous table even though the result is not that object. Keep comments only when the new result is known to be for the same table/schema; otherwise clear them like fresh metadata.
Useful? React with 👍 / 👎.
Summary
Surfaces database object comments in the UI (closes #1771):
A persisted preference (default on) gates the sidebar and grid display. Toggle from View > Show Object Comments. It is intentionally not in the Settings window.
Available for MySQL and PostgreSQL. Other engines simply show no comment.
Why
Column comments were already fetched end-to-end (
PluginColumnInfo.commenttoColumnInfo.comment) but dropped before reaching the grid. Table comments had no model field or fetch at all. This wires both through.Changes
PluginTableInfogainscommentvia a new init overload; the old init stays as@_disfavoredOverloadso already-built registry plugins keep loading. Additive, no PluginKit version bump.TableInfogainscomment, excluded from equality and hashing to preserve the sidebar selection-set invariant.fetchTablesreadsTABLE_COMMENTfrominformation_schema.TABLES(guards the view-comment quirk). PostgreSQLfetchTablesleft-joinspg_descriptionon every branch.ParsedSchemaMetadatatoTableRows.columnCommentstoNSTableColumn.headerToolTip.GeneralSettings.showObjectComments(default on) plus a View-menu toggle.Testing
Tests added:
TableInfocomment-ignores-identity,TableRows.columnComments,parseSchemaMetadatacomment extraction,PluginTableInfoCodable, PostgreSQLfetchTablesSQL.This machine has only Command Line Tools, so I could not build, run the test suite, run swiftlint, or run
scripts/check-pluginkit-abi.shlocally. Please build and run tests in Xcode. The PluginKit change is additive by the documented pattern; running the ABI script before release is still recommended.Docs updated: mysql and postgresql database pages. CHANGELOG entry added.
Fixes #1771