Prisma1: Nested Delete Mutations

Created on 29 Nov 2016  路  3Comments  路  Source: prisma/prisma1

Extend nested mutation feature to include delete mutations. Helpful when you have dependent children and want to delete them given the deletion of the parent. Might look like:

mutation deleteCategory($id: ID!) {
    deleteCategory(id: $id, subCategories: ALL) {
        id
    }
}

Most helpful comment

Rails has something called a dependent property for a relation and you can set it to destroy. Like User has many Books, dependent => destroy(not actual syntax). This would just remove any associated book records if a user is deleted. Maybe add this setting when creating a relation between two different models.

All 3 comments

Thanks for suggesting this feature @thomaswright! We'll consider it while evolving the API design! 馃憤

Rails has something called a dependent property for a relation and you can set it to destroy. Like User has many Books, dependent => destroy(not actual syntax). This would just remove any associated book records if a user is deleted. Maybe add this setting when creating a relation between two different models.

A nested delete action has been implemented in the Prisma 1.0 release.

A cascading delete future will be added soon, as discussed here: #1262.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fi1osof picture Fi1osof  路  3Comments

ragnorc picture ragnorc  路  3Comments

AlessandroAnnini picture AlessandroAnnini  路  3Comments

canercandan picture canercandan  路  3Comments

sedubois picture sedubois  路  3Comments