Gorka CesiumG
Convex Communityβ€’2y agoβ€’
3 replies
Gorka Cesium

how to delete the references in other tables to a deleted item?

If i delete a quoteItem, how can i delete also the other tables that are referencing this item ?

export const delete_ = mutation({
  args: {
    id: v.id('quoteItems'),
  },
  handler: async ({ db }, { id }) => {
    // Validate arguments here. Throw error if invalid. Example `typeof city !== "string" ||`
    if (typeof id !== 'string') {
      throw new Error('Invalid argument')
    }
    // TODO how to clean other tables that reference this item?
    return await db.delete(id)
  },
})
Was this page helpful?