Okay, so I’ve been messing around with this thing called “ultralight tombstone” for a project, and let me tell you, it was a bit of a journey. I wanted to share what I did, mostly so I don’t forget, but maybe it’ll help someone else out there too.

What I Was Trying To Do
Basically, I needed a super simple way to mark stuff as “deleted” in my data without actually deleting it. Think of it like putting a sticky note on a file saying “don’t use this anymore” instead of shredding it. Why? Well, sometimes you need to keep that old data around for, you know, reasons. Auditing, maybe, or some kind of “undo” feature.
My First Attempt (and Fail)
At first, I thought, “Easy! I’ll just add a ‘deleted’ column to my table, a simple boolean, true or false.” Seemed straightforward, right? I added a `deleted` field (a boolean) to my data structure. Set it to `false` by default.
I wrote some quick code to update that field when I wanted to “delete” something.
Then I had a problem. It turned out this was too simple.I added a boolean column to my thing, defaulted it to `false`. It worked, kinda. But, I had a few issue that made me get back to find a better way. So, I’ve to find a more proper way to do this.
Getting a Bit Smarter
I was needed something that was it can solve my problems with old solution, I did some digging, I found this “tombstone” idea. It’s still pretty basic, but with a tiny bit more oomph.

Here’s what I ended up doing:
- New Field: Instead of just “deleted,” I used something. It’s a number.
- Marking as Deleted: When I want to “delete” something, set “delete” number as`1`.
- Checking if Deleted:And that’s my tombstone! In my code, it is pretty simple: if the “delete” is`1`, the data had been delete.
Putting It All Together
So, let see my way to deal with tombstone.
I went and modified all my queries (the things that fetch data) to check if the deleted number larger than `0`. If it is, they ignore that data. It’s like it’s not even there.
I made sure to update my “delete” function to set the number larger than `0`.
The Result (It Works!)
And… it worked! I can now “delete” things, and they disappear from my app, but the data is still there in the database, just chilling with its “tombstone.” I can go back and look at it if I need to, or even “undelete” it by setting number back to `0`.

It’s not rocket science, this whole tombstone thing. But it’s a neat little trick that solved my problem. Plus, it’s way lighter than some of the other solutions I looked at, which involved separate tables and all sorts of complicated stuff. This is just a number, man. Simple and effective.