Safe Mode
Safe Mode is a per-connection guard that intercepts destructive SQL before it runs. When enabled, SoftDB analyzes every query you execute and asks for confirmation before allowing anything that could delete or alter data. It’s a second line of defense against the kind of mistake that’s easy to make and hard to undo.
Enabling Safe Mode
Section titled “Enabling Safe Mode”Safe Mode is configured per connection, not globally. To enable it:
- Open the Connection Hub and click the edit icon on the connection you want to protect, or click New Connection to set it up from the start.
- In the connection form, scroll to the bottom and toggle Safe Mode on.
- Save the connection.
The toggle is labeled Safe Mode and is off by default. Once saved, the setting persists — you don’t need to re-enable it each session.
How It Works
Section titled “How It Works”When Safe Mode is active, SoftDB runs a risk analysis on every query before execution. The analysis parses the SQL, identifies the leading operation, and assigns a risk level:
| Risk level | Description |
|---|---|
| None | Read-only operations (SELECT, SHOW, DESCRIBE) |
| Low | Inspection operations (EXPLAIN) |
| Medium | Data mutations (INSERT, UPDATE, DELETE, CREATE, BEGIN) |
| High | Destructive operations (DROP, TRUNCATE, ALTER) |
Queries classified as medium or high risk trigger a confirmation dialog. The dialog shows the detected operation, the risk level, and the full query text. You must click Confirm to proceed or Cancel to abort.
Read-only queries (SELECT, SHOW, DESCRIBE, PRAGMA) pass through without any prompt.
What Gets Blocked (Pending Confirmation)
Section titled “What Gets Blocked (Pending Confirmation)”Safe Mode requires confirmation for:
DROP TABLE,DROP DATABASE,DROP INDEX— permanent schema deletionDELETEwithout aWHEREclause — deletes all rows in a tableTRUNCATE— empties a table instantly, bypassing row-by-row deletionALTER TABLE— schema changes that may be irreversibleUPDATEwithout aWHEREclause — modifies every row in a table- Any
INSERT,UPDATE,DELETE, orMERGEstatement (medium risk)
What Passes Through Freely
Section titled “What Passes Through Freely”SELECT,SHOW,DESCRIBE,DESC,PRAGMA,VALUES— all read-onlyEXPLAINon a read-only query- MongoDB and Redis queries (classified as limited; always prompt for confirmation)
Best Practices
Section titled “Best Practices”Enable Safe Mode on production connections. It’s the most important place to have it. A mistyped DELETE or a forgotten WHERE clause on a production database can cause real damage. The extra confirmation click is worth it.
Leave it off for local development. When you’re iterating quickly on a dev database, the confirmation dialogs slow you down. Safe Mode is designed for connections where mistakes have consequences.
Use it alongside read-only database users. Safe Mode is a UI-level guard, not a database-level permission. For the strongest protection on production, combine Safe Mode with a database user that has only SELECT privileges. Safe Mode catches mistakes; the database user prevents them at the server level.