Skip to content

Sidebar: context menus for connections, schemas and objects - #9

Merged
FabioHAraujo merged 6 commits into
mainfrom
feat/tree-context-menus
Oct 23, 2026
Merged

FabioHAraujo merged 6 commits into
mainfrom
feat/tree-context-menus

Conversation

@FabioHAraujo

@FabioHAraujo FabioHAraujo commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Closes #8

Problem and resulting behavior

The sidebar only had a small ⋯ menu on connections. Schemas, databases and objects had no actions, so dropping a table, reading its DDL, renaming it or creating a new one meant writing the SQL by hand.

Now a right-click (or the context-menu key, or the ⋯ button shown on hover) opens a menu for every node of the tree, with what makes sense for that node and engine:

  • Connection: new query, connect, refresh, disconnect, create schema (Oracle: a user template) or database, server sessions, show a SQLite file in its folder, edit, duplicate, copy details, delete.
  • Schema / database: new query working in it, refresh, create table (designer), view/function/procedure/sequence templates, rename (PostgreSQL), copy name, drop (type the name to confirm; CASCADE where supported), Redis FLUSHDB.
  • Tables and other objects: select, count, Show DDL, generate SELECT/INSERT/UPDATE/DELETE/CREATE INDEX, edit table (designer → per-engine ALTER TABLE), rename, duplicate with or without rows, empty, refresh materialized views, copy names and column lists, drop any kind of object. Redis keys: show, TTL, rename, expire, persist, delete.

Every change shows its SQL before running (on the tree's own session, never a tab's) and can open in the editor instead.

Backend: a new object_ddl command reads DDL from each database's catalog (pg_get_*def + catalog, DBMS_METADATA, SHOW CREATE, OBJECT_DEFINITION + sys.*, sqlite_schema), and list_columns now reports column defaults.

Validation

  • src/lib/sql/ddl.fixtures.json holds the statements ddl.ts writes for a full scenario per dialect (create, index, foreign key, designer ALTERs, rename, duplicate, truncate, drop, schemas, primary key added later). drivers/ddl_fixtures.rs runs it on PostgreSQL 13 and 17, Oracle 23ai and XE 21c, MySQL 8.4, MariaDB 11.4, SQL Server 2022 and SQLite in CI, plus a DDL round trip for tables, views and sequences (read the DDL, drop the object, run the DDL, compare the columns) and a DDL check for functions.
  • bun test (unit tests for ddl.ts, including that the editor's script splitter keeps PL/SQL and T-SQL blocks whole), svelte-check, cargo clippy -D warnings, cargo fmt.
  • Menus, dialogs and the designer checked in the browser with the development mock, and in a debug build of the Tauri app (embedded assets) against a real SQLite file: Show DDL, designer rename + add column, duplicate with rows, count, empty, drop view, drop table with typed confirmation.

Additional context

…s per engine

object_ddl scripts tables, views, routines, sequences and other objects from
each database's catalog; columns report their default. ddl.ts writes the
CREATE/ALTER/RENAME/DROP/TRUNCATE statements the sidebar will use, and the
fixtures run them, with a DDL round trip, against every database.
Right-click, the context-menu key or the row's ⋯ button opens a menu for the
node: connect, refresh, create schemas and databases, server sessions and the
profile actions on connections; new query, create table, object templates,
rename and drop on schemas; select, count, DDL, generated SQL, edit, rename,
duplicate, empty and drop on tables, with Redis key actions. Changes show
their SQL first and can open in the editor instead. A table designer creates
tables and writes ALTER TABLE for each engine.
@FabioHAraujo
FabioHAraujo marked this pull request as ready for review October 22, 2026 20:26
DBMS_METADATA fails to fetch functions on Oracle 23ai with ORA-01002.
Running a cached DBMS_METADATA query a third time in a session fails with
ORA-01002 on Oracle 23ai; each Show DDL query now opens its own cursor.
@FabioHAraujo
FabioHAraujo merged commit e2fff1f into main Oct 23, 2026
17 checks passed
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.

Sidebar: context menus for connections, schemas/databases and tables

1 participant