Skip to content

feat(linux): truncate tables and create or drop databases and schemas from the sidebar - #4050

Merged
datlechin merged 10 commits into
mainfrom
feat/linux-truncate-create-db
Nov 6, 2026
Merged

datlechin merged 10 commits into
mainfrom
feat/linux-truncate-create-db

Conversation

@datlechin

@datlechin datlechin commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Linux sidebar: Truncate Table… on tables, Delete All Documents… on MongoDB collections.
  • Linux sidebar: New Schema… and Drop Schema… on PostgreSQL, SQL Server and DuckDB.
  • Linux sidebar: New Database… (New Keyspace… on Cassandra) on the connection row, Drop Database… on database rows, on the connection row of PostgreSQL and SQL Server, and on a database open beside it.
  • Drop is never offered for system objects, the session's own database, the default schema, SQL Server dbo or DuckDB main.
  • Confirmations are AdwAlertDialogs: Cancel is the default, the verb is red, engine options are switches, and Confirm Writes shows the SQL. New Database and New Schema ask under Confirm Writes before they run. Read-Only offers none of them.
  • New Database shows only the engine's options: owner, template, encoding, locale (PostgreSQL); character set, collation (MySQL); collation (SQL Server); cluster (ClickHouse, only for a cluster of several servers); replication, durable writes, tablets (Cassandra/ScyllaDB); first collection (MongoDB).
  • Core: DdlDialect plans truncate and schema/database create and drop per engine, MongoDB through its shell, so Windows can reuse them (core ADR 0013).
  • Core: WriteKind::DatabaseChanges runs outside a transaction, which PostgreSQL and SQL Server need for CREATE/DROP DATABASE.
  • Core: Connection::fetch_database_choices fills the New Database pickers.
  • Core: DriverError::DatabaseNotFound, mapped at login on PostgreSQL, MySQL, ClickHouse and Cassandra.
  • PostgreSQL truncate offers Restart Identity and Cascade and names every table Cascade empties. PostgreSQL 13+ drops a database with Close Other Connections.
  • MySQL, SQL Server and SQLite refuse to truncate a table another table's key points at, and name those tables. On SQLite the DELETE would otherwise run their ON DELETE action.
  • SQLite truncates with DELETE and gets no database or schema items: ATTACH lasts one connection.
  • Dropping a database open beside the connection runs its disconnect prompts, waits for it to close and keeps it from reopening until the DROP ends (Linux ADR 0034).
  • MySQL lists every database as its schemas, so an empty one shows. A Windows MySQL connection now gets a folder per database.
  • A MongoDB catalog command or many-document write whose outcome is not certain is reported as such, not as rolled back.
  • Fixed: Drop Table wrote no history entry and did not resolve a lost commit.
  • Fixed: a session whose database was dropped reconnected forever. It now stops with "The database “x” does not exist on the server."
  • Fixed: a schema or database with no tables had no sidebar row, so New Table… could not reach it.
  • Fixed: editor tabs' database lists were not read again on Refresh or after another tab's DDL.
  • Fixed: tabs closed by Drop Table went onto Reopen Closed Tab.
  • Not included: Redis. It has no tables and its numbered databases cannot be created or dropped. FLUSHDB stays in the editor.
  • Not included: SQL Server Close Other Connections. A cancelled drop could leave the database single-user.
  • Not included: MySQL's switch that turns foreign key checks off for a truncate. It would leave rows pointing at nothing.
  • Tests changed on purpose: an_open_connection_with_nothing_to_list_says_so, clearing_a_search_over_an_emptied_list_says_there_are_no_tables, a_list_of_collections_or_keys_says_so_when_it_is_empty, a_file_no_saved_connection_names_has_a_row_of_its_own, every_item_carries_the_object_key, a_collection_offers_neither_sql_nor_a_drop_the_dialect_cannot_plan, and MySQL objects_and_estimates_are_listed.
Before After
Before After
Before, dark After, dark

Truncate
Truncate, dark

Test plan

  • Golden plan tests per driver, and one per driver that every offered operation plans.
  • DDL conformance cases for truncate, schema and database round trips, run on each engine's Docker suite (PostgreSQL, MySQL, MariaDB, SQL Server, ClickHouse, Cassandra, MongoDB passed locally).
  • Login tests for DatabaseNotFound.
  • Widget tests for the menus, prompts, Read-Only, Confirm Writes, the sibling drop, history and the reopen stack.
  • Local: lint clean, app suite 2896/2896.

@datlechin
datlechin enabled auto-merge (squash) November 5, 2026 07:05
@datlechin
datlechin disabled auto-merge November 6, 2026 01:07
…reate-db

# Conflicts:
#	core/crates/core/src/connection.rs
#	core/crates/drivers/mssql/src/ddl.rs
#	core/docs/decisions/README.md
#	linux/ROADMAP.md
#	linux/crates/app/src/ui/workspace/mod.rs
#	linux/docs/decisions/README.md
…reate-db

# Conflicts:
#	core/docs/decisions/README.md
#	linux/docs/decisions/README.md
@datlechin
datlechin merged commit c141563 into main Nov 6, 2026
1 of 4 checks passed
@datlechin
datlechin deleted the feat/linux-truncate-create-db branch November 6, 2026 03:03
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