From 06f79a8d037d3c723b40728c0eb9ddf3f24fbc75 Mon Sep 17 00:00:00 2001 From: haos Date: Wed, 10 Jun 2026 19:23:46 +0800 Subject: [PATCH] Align plugin trigger capability docs --- plugins/PLUGIN_GUIDE.md | 61 ++++++++++++++++++++++++++++++++++-- plugins/manifest.schema.json | 11 +++++++ 2 files changed, 70 insertions(+), 2 deletions(-) diff --git a/plugins/PLUGIN_GUIDE.md b/plugins/PLUGIN_GUIDE.md index be2d2f1f..07b7c4f5 100644 --- a/plugins/PLUGIN_GUIDE.md +++ b/plugins/PLUGIN_GUIDE.md @@ -101,12 +101,14 @@ The manifest tells Tabularis everything about your plugin. | `schemas` | bool | `true` if the database supports named schemas (like PostgreSQL). Controls whether the schema selector is shown in the UI. | | `views` | bool | `true` if the database supports views. Enables the views section in the explorer. | | `routines` | bool | `true` if the database supports stored procedures/functions. | +| `triggers` | bool | `true` if the database supports triggers. Enables trigger-related UI for drivers that implement the trigger RPCs. | | `file_based` | bool | `true` for local file databases (e.g., SQLite, DuckDB). Replaces host/port with a file path input in the connection form. | | `folder_based` | bool | `true` for plugins that connect to a directory rather than a single file (e.g. CSV plugin). Replaces host/port with a folder picker. | | `no_connection_required` | bool | `true` for API-based plugins that need no host, port, or credentials (e.g. a public REST API). Hides the entire connection form — the user only fills in the connection name. | | `connection_string` | bool | Set `false` to hide the connection string import UI for this driver. Defaults to `true` for network drivers. `file_based` and `folder_based` drivers skip the import UI automatically regardless of this flag. | | `connection_string_example` | string | Optional placeholder example shown in the connection string import field (e.g. `"clickhouse://user:pass@localhost:9000/db"`). Also accepted as camelCase `connectionStringExample`. | | `identifier_quote` | string | Character used to quote SQL identifiers. Use `"\""` for ANSI standard or `` "`" `` for MySQL style. | +| `sql_dialect` | string | Optional statement-splitting dialect: `postgres`, `mysql`, `mssql`, `sqlite`, `oracle`, or `generic`. Oracle-like plugins, including DM/Dameng, should use `"oracle"`. | | `alter_primary_key` | bool | `true` if the database supports altering primary keys after table creation. | | `manage_tables` | bool | `true` to enable table and column management UI (Create Table, Add/Modify/Drop Column, Drop Table). Does not control index or FK operations. Defaults to `true`. | | `readonly` | bool | When `true`, the driver is read-only: all data modification operations (INSERT, UPDATE, DELETE) are disabled in the UI. The add/delete row buttons, inline cell editing, and context menu edit actions are hidden. Table and column management is also hidden regardless of `manage_tables`. Defaults to `false`. | @@ -640,8 +642,8 @@ Get column information for a table. "name": "id", "data_type": "INTEGER", "is_nullable": false, - "column_default": null, - "is_primary_key": true, + "default_value": null, + "is_pk": true, "is_auto_increment": true, "comment": null } @@ -798,6 +800,61 @@ Get the SQL body of a stored routine. --- +### Triggers + +Set `capabilities.triggers` to `true` when your driver implements the trigger RPCs. Tabularis uses this flag to show trigger-related UI. + +#### `get_triggers` + +List triggers in a schema/database. + +**Params:** `{ "params": ConnectionParams, "schema": string | null }` + +**Result:** +```json +[ + { + "name": "users_audit_trg", + "table_name": "users", + "event": "INSERT OR UPDATE", + "timing": "AFTER", + "definition": "CREATE TRIGGER users_audit_trg ..." + } +] +``` + +--- + +#### `get_trigger_definition` + +Get the SQL definition of a trigger. + +**Params:** `{ "params": ConnectionParams, "schema": string | null, "trigger_name": string, "table_name": string }` + +**Result:** `"CREATE TRIGGER users_audit_trg ..."` + +--- + +#### `create_trigger` + +Create a trigger from SQL generated by the UI or entered in raw SQL mode. + +**Params:** `{ "params": ConnectionParams, "schema": string | null, "trigger_sql": string }` + +**Result:** `null` on success, or an error. + +--- + +#### `drop_trigger` + +Drop a trigger. + +**Params:** `{ "params": ConnectionParams, "schema": string | null, "trigger_name": string, "table_name": string }` + +**Result:** `null` on success, or an error. + +--- + ### Query Execution #### `execute_query` diff --git a/plugins/manifest.schema.json b/plugins/manifest.schema.json index 63d0fdef..1f040bc5 100644 --- a/plugins/manifest.schema.json +++ b/plugins/manifest.schema.json @@ -75,6 +75,11 @@ "type": "boolean", "description": "true to enable stored procedures and functions in the database explorer." }, + "triggers": { + "type": "boolean", + "default": false, + "description": "true if the driver supports trigger metadata and trigger management RPCs." + }, "file_based": { "type": "boolean", "description": "true for local file databases (e.g. SQLite, DuckDB). Replaces the host/port fields with a file path input." @@ -109,6 +114,12 @@ "enum": ["\"", "`"], "description": "Character used to quote SQL identifiers: double-quote for ANSI SQL, backtick for MySQL-style." }, + "sql_dialect": { + "type": "string", + "enum": ["postgres", "mysql", "mssql", "sqlite", "oracle", "generic"], + "default": "postgres", + "description": "SQL dialect used by Tabularis for statement splitting and query classification. Oracle-like plugins can use oracle." + }, "alter_primary_key": { "type": "boolean", "description": "true if the database supports altering primary keys after table creation."