Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting required relation crashes #463

Closed
timsuchanek opened this issue Jul 7, 2020 · 2 comments
Closed

Deleting required relation crashes #463

timsuchanek opened this issue Jul 7, 2020 · 2 comments
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug.
Milestone

Comments

@timsuchanek
Copy link

Schema

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "sqlite"
  url      = env("DATABASE_URL")
}

model Post {
  id        Int      @default(autoincrement()) @id
  createdAt DateTime @default(now())
  title     String
  content   String?
  published Boolean  @default(false)
  author    User     @relation(fields: [authorId], references: [id])
  authorId  Int
}

model Profile {
  id     Int     @default(autoincrement()) @id
  bio    String?
  user   User    @relation(fields: [userId], references: [id])
  userId Int     @unique
}

model User {
  id      Int      @default(autoincrement()) @id
  email   String   @unique
  name    String?
  posts   Post[]
  profile Profile?
}

If I want to delete a User, that has posts, Studio crashes.

npx @timsuchanek/auto prisma for reproduction.

@timsuchanek timsuchanek added bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. process/candidate Candidate for next Milestone. labels Jul 7, 2020
@sdnts sdnts self-assigned this Jul 7, 2020
@janpio janpio added this to the 2.3.0 milestone Jul 8, 2020
@janpio janpio removed the process/candidate Candidate for next Milestone. label Jul 8, 2020
@sdnts
Copy link
Contributor

sdnts commented Jul 9, 2020

@timsuchanek It seems this also happens in a standalone script. Pretty sure prisma/prisma#2810 will fix this (or give me a way/API to fix this). Keeping this open till that happens so I can verify!

@sdnts
Copy link
Contributor

sdnts commented Jul 21, 2020

Closing this, created #473 to track cascading deletes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug.
Projects
None yet
Development

No branches or pull requests

3 participants