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

Add ability to unlink optional relation #615

Closed
2color opened this issue Jan 22, 2021 · 2 comments
Closed

Add ability to unlink optional relation #615

2color opened this issue Jan 22, 2021 · 2 comments
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug.
Milestone

Comments

@2color
Copy link

2color commented Jan 22, 2021

I was trying to unlink a post from a specific author and couldn't find a way to do that with Prisma Studio:

  1. Prisma version (prisma -v or npx prisma -v):
@prisma/cli          : 2.15.0
@prisma/client       : 2.15.0
Current platform     : darwin
Query Engine         : query-engine e51dc3b5a9ee790a07104bec1c9477d51740fe54 (at node_modules/@prisma/engines/query-engine-darwin)
Migration Engine     : migration-engine-cli e51dc3b5a9ee790a07104bec1c9477d51740fe54 (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core e51dc3b5a9ee790a07104bec1c9477d51740fe54 (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary        : prisma-fmt e51dc3b5a9ee790a07104bec1c9477d51740fe54 (at node_modules/@prisma/engines/prisma-fmt-darwin)
Studio               : 0.340.0
  1. Prisma schema (if relevant):
generator client {
  provider = "prisma-client-js"
}

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

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

model User {
  id    Int     @default(autoincrement()) @id
  email String  @unique
  name  String?
  posts Post[]
}
@sdnts sdnts added bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. labels Feb 4, 2021
@sdnts
Copy link
Contributor

sdnts commented Feb 4, 2021

I don't know how I'm just seeing this, but this is most definitely a bug. The relation and the scalar field it is composed of should have a two-way binding. If you clear the relation, it should change the scalar and register as an edit. (and the other way around)

I'll take a look soon! Thanks for reporting!

@sdnts sdnts added this to the 2.18.0 milestone Feb 17, 2021
@sdnts
Copy link
Contributor

sdnts commented Feb 26, 2021

@2color This should now be possible in the latest dev version of the Prisma CLI. This will also make it to 2.18.0 this Tuesday!

@sdnts sdnts closed this as completed Feb 26, 2021
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

2 participants