Abluux
PPrisma
•Created by Abluux on 1/7/2025 in #help-and-questions
npx prisma migrate dev doesnt update @relation
await prisma.$transaction(async (prisma) => {
const todos = await prisma.todo.findMany({
where: { organizationId, assignedUsers: { some: { uid: userToDisassociate } } },
});
for (const todo of todos) {
await prisma.todo.update({
where: { id: todo.id },
data: { assignedUsers: { disconnect: { uid: userToDisassociate } } },
});
}
await prisma.organization.update({
where: { id: organizationId },
data: {
users: {
disconnect: { uid: userToDisassociate },
},
},
});
});
Something like this?10 replies
PPrisma
•Created by Abluux on 1/7/2025 in #help-and-questions
npx prisma migrate dev doesnt update @relation
also getting typecript error when trying to disconnect assignedUsers from my todo
Object literal may only specify known properties, and 'assignedUsers' does not exist in type '(Without<TodoUpdateManyMutationInput, TodoUncheckedUpdateManyInput> & TodoUncheckedUpdateManyInput) | (Without<...> & TodoUpdateManyMutationInput)'.ts(2353)
index.d.ts(3290, 5): The expected type comes from property 'data' which is declared here on type '{ data: (Without<TodoUpdateManyMutationInput, TodoUncheckedUpdateManyInput> & TodoUncheckedUpdateManyInput) | (Without<...> & TodoUpdateManyMutationInput); where?: TodoWhereInput | undefined; }'
(property) assignedUsers: {
disconnect: {
uid: any;
};
await prisma.todo.updateMany({
where: { organizationId },
data: { assignedUsers: { disconnect: { uid: userToDisassociate } } },
});
10 replies
PPrisma
•Created by Abluux on 1/7/2025 in #help-and-questions
npx prisma migrate dev doesnt update @relation
i make my schema on backend and i do npx prisma db pull to get schema to frontend, this schema is not uptated to that
10 replies