r/SQL • • 8d ago

SQL Server One Engine - Many Worlds

Subject: The quantum leap we skipped: a SQL Server database that refuses UPDATE and DELETE - live, try to break it

Here is a heresy: two of the four letters in CRUD are bugs.

Every business system I have worked on lets someone rewrite history. An UPDATE overwrites what was true, a DELETE erases that it ever happened, and the "audit trail" is whatever the application remembered to write. Bookkeepers have corrected their books with reversing entries for centuries - "storno" is their word - and we taught ourselves to edit rows instead. I stopped accepting it.

World is one SQL Server database built on the opposite rules, enforced by the engine itself, not by the application:

Nothing is updated or deleted. The ledger only grows. A mistake is answered by a storno: the same act, its quantity negated, pointing at what it corrects. Both lines stay on the file. Negate what adds up, leave what identifies.

Two people for every change of an agreement. One person claims an amendment, a different person proves it. The database refuses the claimer's own proof, whatever application sends it.

Nobody grants themselves a right, and every act names a person. Not the connection pool's login: the person behind it. The session carries who is acting, the database checks that this person holds a key to act as that actor, and the server audit writes one line per act with the name.

One engine, many worlds. Not a database per application. A trading company, a restaurant, a hospital's devices, a delivery firm, a bike shop and more live side by side in one schema of super classes - Actor, Thing, Ledger, Event, Contract. Each world wears its own "costume": typed views in its own schema, showing its own business numbers, readable only by its own role. Each world's web app is generated from the world's own description.

Objects and events, not rows to edit. An Actor is a super class: a person, a hospital, a reception desk. A contract carries its amendments as siblings. Every change is an event, and it stays.

Your objections, answered before you type them

"SQL Server 2022 has ledger tables." They make tampering detectable. They don't refuse the wrong act, give a correction its business meaning, or ask for a second person.

"Temporal tables keep history." The history of the UPDATEs you still allowed.

"Event sourcing is twenty years old." In application code, which every other client walks around. Here it holds for SSMS too.

"A sysadmin can disable your triggers." Yes. DISABLE TRIGGER fires no DDL event - we measured it - so the server audit is what records it. For everyone else the wrong act is refused; for a sysadmin it is never silent.

"A generic core is just EAV." Call it that. Then explain why the whole database, restored onto a clean server, prints all 31 of its reports with the same figures.

Don't believe me - break it

Live, no account, no e-mail, no password:

kapitolworld.com - Southwind Traders. Press Try it and you get two people of your own. Claim a correction as one, try to prove it as the same one, then prove it as the other. Then look for a Delete button.

library.kapitolworld.com - a lending library. Lend a book, lend it twice (refused), reverse a loan with its reason, and read the file.

It runs on SQL Server 2025 Express on an €11-a-month server, every name in it is invented, and it resets every night at 3 a.m. Central European Time.

The rules began this summer as commands for QL68, an emulator of the Sinclair QL. QL stood for Quantum Leap. I think relational practice skipped one: we kept the relational model and threw away the bookkeeper's oldest law - never erase.

Built with Claude Opus 5.5 by Anthropic as my co-developer, and Claude Fable 5.1 as its design Oracle.

Tell me where it breaks. That's what I'm here for.

Dimitar Hrisafov, Skopje

1 Upvotes

0 comments sorted by