Cascades impersonations on user delete (#2891)
Co-authored-by: Alex van Andel <me@alexvanandel.com>
This commit is contained in:
parent
a0a4ff6ce6
commit
9710c6faa6
|
@ -0,0 +1,11 @@
|
|||
-- DropForeignKey
|
||||
ALTER TABLE "Impersonations" DROP CONSTRAINT "Impersonations_impersonatedById_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Impersonations" DROP CONSTRAINT "Impersonations_impersonatedUserId_fkey";
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Impersonations" ADD CONSTRAINT "Impersonations_impersonatedUserId_fkey" FOREIGN KEY ("impersonatedUserId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Impersonations" ADD CONSTRAINT "Impersonations_impersonatedById_fkey" FOREIGN KEY ("impersonatedById") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@ -402,8 +402,8 @@ model Webhook {
|
|||
model Impersonations {
|
||||
id Int @id @default(autoincrement())
|
||||
createdAt DateTime @default(now())
|
||||
impersonatedUser User @relation("impersonated_user", fields: [impersonatedUserId], references: [id])
|
||||
impersonatedBy User @relation("impersonated_by_user", fields: [impersonatedById], references: [id])
|
||||
impersonatedUser User @relation("impersonated_user", fields: [impersonatedUserId], references: [id], onDelete: Cascade)
|
||||
impersonatedBy User @relation("impersonated_by_user", fields: [impersonatedById], references: [id], onDelete: Cascade)
|
||||
impersonatedUserId Int
|
||||
impersonatedById Int
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user