Week 15: Using Delete vs Destroy Operations on the 8base GraphQL API

When it comes to deleting data, there are two different types of GraphQL operations that can be used: Delete and Destroy. Both of these operations may sound the same, but they work in different ways.

Using Delete versus Destroy1

Delete operations add a “deletedAt” timestamp to records, which means they’re not really deleted, but just stop showing up in query results. This is useful if you need to keep track of what has been deleted, or if you want to be able to undelete (a.k.a. Restore) something later on.

Using Delete versus Destroy2

Destroy operations permanently destroy data, which means it can’t be recovered. This is best for cases where you don’t need to keep track of what has been deleted, or when you want to make sure that the data is gone for good.

So which one should you use? It depends on your needs. If you need to track what has been deleted, or if you might want to undelete something later, then you should use a Delete operation. If you’re sure that you never want to see the data again, or if you don’t need to keep track of what’s been deleted, then go ahead and use a Destroy operation.

Check out the 8base Academy Video on Deleting vs Destroying Records on the GraphQL API to learn more. If you have any questions about this, definitely ask them in the 8base Community!

Happy Deleting!

Sebastian