feat(structure): triggers for more engines, metadata columns, filter/sort, persisted layout#1703
Conversation
…D1 plus metadata columns, filter/sort, and persisted layout
|
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: 35f341762a
ℹ️ 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".
| event: event, | ||
| statement: definition | ||
| statement: definition, | ||
| enabled: row[4].asText == "t", |
There was a problem hiding this comment.
Compare against the normalized PostgreSQL boolean
This value comes from t.tgenabled <> 'D', and the libpq bridge normalizes PostgreSQL boolean columns to the text values "true"/"false" before plugin code sees them. Comparing to "t" makes every enabled PostgreSQL trigger display as disabled whenever the new Enabled column is shown, so the trigger metadata is misleading for normal triggers.
Useful? React with 👍 / 👎.
…split panes self-update without rebuilding
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c06e51424
ℹ️ 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".
| let statement = """ | ||
| CREATE OR REPLACE TRIGGER \(quotedName) | ||
| \(timing) \(event) ON \(quotedTable)\(forEach) | ||
| """ |
There was a problem hiding this comment.
Include Oracle trigger bodies in the displayed DDL
For Oracle connections with any table trigger, supportsTriggers now exposes this result in TriggerDetailView, which renders/copies PluginTriggerInfo.statement; however this statement is synthesized from only the trigger header and never selects or appends ALL_TRIGGERS.TRIGGER_BODY (or the WHEN clause). The details, Open in Editor, and Copy actions therefore show DDL that cannot recreate the trigger and omits the actual PL/SQL logic, so please fetch the body or use DBMS_METADATA before returning the statement.
Useful? React with 👍 / 👎.
… 14.0-safe Enabled column variant
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b1054780fc
ℹ️ 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".
| te.type_desc AS event | ||
| FROM sys.triggers t | ||
| JOIN sys.trigger_events te ON t.object_id = te.object_id | ||
| WHERE t.parent_id = OBJECT_ID('\(bracketedFull)') |
There was a problem hiding this comment.
Escape quotes before calling OBJECT_ID
For SQL Server tables or schemas whose identifier contains a single quote (valid when bracket-quoted, e.g. [O'Brien]), bracketedFull only escapes ] and is then interpolated into a quoted OBJECT_ID('...') literal. Opening the Triggers tab for such a table will at least fail with malformed SQL, and a malicious identifier can terminate the string and append extra statements; escape ' in the full object-name literal before interpolation.
Useful? React with 👍 / 👎.
| statement: String, | ||
| enabled: Bool? = nil |
There was a problem hiding this comment.
Keep the four-argument trigger initializer
Adding enabled by changing the existing public initializer removes the old PluginTriggerInfo(name:timing:event:statement:) ABI symbol. Source callers still compile because of the default argument, but already-built plugins that construct trigger info against the previous PluginKit can fail to load or call this initializer; follow the existing PluginKit pattern and add a separate @_disfavoredOverload four-argument initializer that forwards with enabled: nil.
Useful? React with 👍 / 👎.
Follow-up to #1696 (read-only v2). Extends the Triggers tab to more engines, adds richer metadata, and polishes the UI.
Engines
fetchTriggersadded to the registry plugins (each ABI-additive, no PluginKit bump):sys.triggers+OBJECT_DEFINITION(full body), events aggregated fromsys.trigger_eventsSwift-side (noSTRING_AGGversion dependency),enabledfromis_disabled, timing AFTER/INSTEAD OF.sqlite_master+TriggerSQLParser(D1 filters_cf_*).ALL_TRIGGERSmetadata only. The body is intentionally not fetched:TRIGGER_BODYis aLONGcolumn OracleNIO can't read andDBMS_METADATA.GET_DDLcorrupts the OracleNIO connection (existingORA-31603guard). Shows a reconstructedCREATE OR REPLACE TRIGGERheader,enabledfromSTATUS,whenfromWHEN_CLAUSE.supportsTriggers = trueset on each plugin'sDriverPluginconformer.Richer columns
PluginTriggerInfo/TriggerInfogain optionalenabled,orientation,whenClause(new init; the v1 4-arg init kept as@_disfavoredOverloadper the PluginKit ABI rule). The trigger table shows For Each, Enabled, and When columns only when the data is present (PostgreSQL populates all three; SQL Server/Oracle populate enabled).Filter + sort
A filter field above the list and clickable column sort (SwiftUI
TablesortOrder).Persistence
@AppStorage("structureCodeFontSize")(was plain@Stateresetting every open; also fixes the DDL tab and standardizes the editor font size onDouble).AutosavingVSplitView(NSSplitView+autosaveName, set after items are added) so the table/detail divider survives reopen.Notes
plugin-mssql-v*,plugin-oracle-v*,plugin-libsql-v*,plugin-cloudflare-d1-v*(all additive). Bundled MySQL/MariaDB/PostgreSQL/SQLite ship with the app.Tests
TriggerInfoMappingTestsupdated for the new fields (Codable round-trip + adapter mapping).TriggerSQLParserTestsalready cover the SQLite/libSQL/D1 parse path.CI lints the app target (
included: TablePro); changed app files are SwiftLint--strictclean.