383: Soft Delete All

CodePen Radio

Episode | Podcast

Date: Wed, 31 Aug 2022 19:18:45 +0000

<p>In this show, Stephen and Chris get to talk about an internal technical detail we were improving in our database, which led to a public-facing feature for y'all. The idea is that all (most, anyway) database tables should have a deleted_at column. When you query against them, under regular circumstances, any rows that have a non-null value will be filtered out. This is the concept of "soft" delete. It's not really gone from the database, it just behaves like it is. This has two clear benefits:</p> <ol><li>Deleting is super fast, it's just manipulating a single value.</li><li>It opens the door for un-deleting things that perhaps were mistakenly deleted. </li></ol> <p>This approach can be slightly more work. You'll need to offer a way to truly wipe data completely for users. You'll probably want a reaper to clean up data that has been deleted long enough. You'll need to comply with regulations about data deletion. You might have to build un-deletion features. You might need to be doing that filtering yourself throughout the app. It's work, but it's generally worth it. </p> <p>In our case, because we soft delete everything on CodePen now, the Deleted Items area of Your Work now works for all Item Types (Pens, Collections, and Projects). Before, it only worked for Pens, and even there it was a little messy as it didn't retain the URL slug or comments and such — now it does. </p> <h3 id="h-time-jumps">Time Jumps</h3> <h3 id="h-sponsor-memberful">Sponsor: <a href="https://srv.buysellads.com/ads/long/x/T6ALLTSDTTTTTTTEKV4NCTTTTTTHWXT6KKTTTTTTO4KECYYTTTTTTWLCZ3QW5ABWZV7CLI3NCQ6HPRS6VHVC52L2P2HT">Memberful</a></h3> <p><a href="https://srv.buysellads.com/ads/long/x/T6ALLTSDTTTTTTTEKV4NCTTTTTTHWXT6KKTTTTTTO4KECYYTTTTTTWLCZ3QW5ABWZV7CLI3NCQ6HPRS6VHVC52L2P2HT">Memberful</a> is a best-in-class membership software used by the web's biggest creators. If you're building a membership website for a client, Memberful handles the hard stuff so you can complete your builds quickly and your clients can focus on creating content while earning revenue with ease. It seamlessly integrates with popular tools like WordPress, Mailchimp, and Discord, so they can reach and monetize their existing audience. Memberful maintains GraphQL API, webhooks, and OAuth Single Sign on to make integration even easier.</p> <p>Help your client monetize their passion. <a href="https://srv.buysellads.com/ads/long/x/T6ALLTSDTTTTTTTEKV4NCTTTTTTHWXT6KKTTTTTTO4KECYYTTTTTTWLCZ3QW5ABWZV7CLI3NCQ6HPRS6VHVC52L2P2HT">Get started for free at Memberful.com</a></p>