plugin schema: onDelete: "cascade" does not work?
Hi,
I am creating my own plugin that creates groups within organizations.
Part of my schema is this:
However, I cannot delete a group if it still has members.
I am getting:
I would assume that onDelete: "cascade" just deletes the the group_member row?
I am creating my own plugin that creates groups within organizations.
Part of my schema is this:
group_member: {
fields: {
groupId: {
type: "string",
required: true,
references: {
model: "group",
field: "id",
onDelete: "cascade",
},
},
memberId: {
// This is supposed to be a organization member id, not a user ID!!!
type: "string",
required: true,
references: {
model: "member",
field: "id",
onDelete: "cascade",
},
},
},
},
However, I cannot delete a group if it still has members.
I am getting:
# SERVER_ERROR: update or delete on table "group" violates foreign key constraint "group_member_groupId_fkey" on table "group_member"I would assume that onDelete: "cascade" just deletes the the group_member row?