Safety & guardrails

Put a thoughtful pause in front of risky work while keeping ordinary reads pleasantly boring.

Good safeguards should catch the expensive mistake without making every ordinary read feel like paperwork. Set a policy on a client, project, environment, server, or database, and it flows down the connection tree until you deliberately change a branch.

The layers, in the order they apply

  1. The editor warns. While you type, validation flags the shapes that tend to go wrong, an UPDATE or DELETE with no WHERE, an identity-column INSERT with no SET IDENTITY_INSERT - as squiggles, before you have run anything.
  2. The run gate asks. On Run, SQLly analyses the batch and decides whether it needs a confirmation, an AI review, or a refusal. Nothing has been sent yet.
  3. The driver enforces. Read-only and rollback-wrap are applied per GO batch inside the driver, on the way out. They are the last word, and they apply no matter which part of the app started the run.

Splitting it this way is deliberate: the two layers that can be fooled by clever SQL only ever warn or ask, and the layer that decides what actually reaches the server is the simple, boring one.

What you can turn on

Read-only connections
Make a connection genuinely read-only when browsing is all it should ever do.
Auto-wrap in a transaction
Put non-read work inside a transaction you can inspect and roll back before it becomes permanent.
Require a confirmation
Ask for an unmistakable "yes, really" before a non-SELECT statement gets to run.
Refuse UPDATE/DELETE with no WHERE
Catch, warn about, or block broad UPDATE and DELETE statements before a tiny omission becomes a very long afternoon.
Environment colors & cues
Give production the visual warning it deserves so your peripheral vision can save the day.
AI review for data-changing queries in progress
Ask for a plain-language read on a query's side effects before it runs in a protected place.

Production is its own layer

A connection marked as a Production environment is read-only by default, whatever its own flags say. When you genuinely need to write, unlock writes for 1, 5, or 15 minutes from the status-bar chip or the command palette. While the window is open the chip counts down (4:59), and every data-changing batch still has to be confirmed with the exact SQL in front of you. When it expires, the connection locks itself again.

The unlock never outlives the app. It is held in memory for the session only, never written to disk, never restored on the next launch. Closing SQLly re-locks production, always.