Deleting things

Probably wishful thinking, and I suspect I know the answer but when a Thing is Deleted using the Data > Delete a Thing workflow…does it just evaporate it forever from the database or is there maybe a hidden table that contains deleted items?

I have a marketplace. If a User deletes an outlet, I might still want to keep records of orders at this outlet for audit purposes. Do I therefore need to create a Type called something like “TblDeletedOutlets” and essentially create a new record in there of the deleted data and then perform the Deletion? And then, thinking about other items that might get deleted (Users etc) do I have to archive them before a User terminates their account too or does Bubble maintain a record of their transactions with a signififier that they’re deleted on it? Just seems like a lot of extra work and storage so I’m wondering if there’s a smarter way of dealing with it.

No… don’t delete the item at all.

Just add a field called ‘deleted’ to the datatype.

Of course, you’ll need to update all your workflows/searches, and privacy rules accordingly.

2 Likes

Hi there, @joefarrowsmith… when a thing is deleted, it is pretty much gone forever. Sure, there are backups of the database that you can access for a certain period of time based on your app’s plan, but you should consider the thing to be gone for all intents and purposes.

If you want to keep records around even if they are “deleted,” what most folks do is add a field to the data type that designates if a record is active or “deleted.” You might consider a yes/no field, and when a record is being deleted, set the field to the value that specifies it has been deleted, and use privacy rules to make sure those things are never returned from the server.

With regard to users, it depends on what you mean by a user terminating their account, but even there, you probably don’t want to nuke users and records but rather consider marking them as deleted or inactive.

Hope this helps.

Best…
Mike

2 Likes

Thanks so much Mike. Nuking data straight out of existence didn’t really sit that well with me. Marking it as deleted is a much softer option. I would have marked this as the solution post but Adam got their first chronologically so he gets the gong this time.

Thanks as always.

Have a great one

Joe

2 Likes

Perfect. Thanks Adam. Makes sense not to blow things away forever the second the “bin” icon is hit.

A bit of legwork follows with filters etc but I’m happier knowing if I’m ever audited, there’ll be a data trail.

Ciao!

2 Likes