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

Nested create broken #721

Closed
timsuchanek opened this issue Apr 28, 2020 · 3 comments
Closed

Nested create broken #721

timsuchanek opened this issue Apr 28, 2020 · 3 comments
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. tech/engines/query engine Issue in the Query Engine tech/engines Issue for tech Engines.
Milestone

Comments

@timsuchanek
Copy link
Contributor

timsuchanek commented Apr 28, 2020

Reproduction here

Schema

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

datasource db {
  provider = "sqlite"
  url      = "file:dev.db"
}

model Link {
  id      Int      @default(autoincrement()) @id
  url     String
  article Article?
}

model Article {
  id     Int     @default(autoincrement()) @id
  linkId Int?    @map("link")
  link   Link?   @relation(fields: [linkId], references: [id])
  title  String?
  text   String?
}

Client call:

  const link = await client.link.create({
    data: {
      url: 'prisma.io',
      article: {
        create: {
          text: 'Landingpage',
          title: 'Awesome',
        },
      },
    },
    include: { article: true },
  })

Underlying query

mutation {
  createOneLink(data: {
    url: "prisma.io"
    article: {
      create: {
        text: "Landingpage"
        title: "Awesome"
      }
    }
  }) {
    id
    url
    article {
      id
      linkId
      title
      text
    }
  }
}

The field linkId stays empty in the database for the newly created link.

@dpetrick
Copy link
Contributor

Potentially related: prisma/prisma#2087

@timsuchanek timsuchanek added bug/2-confirmed Bug has been reproduced and confirmed. tech/engines/query engine Issue in the Query Engine kind/bug A reported bug. tech/engines Issue for tech Engines. process/candidate labels Apr 29, 2020
@divyenduz divyenduz added this to the Beta 5 milestone Apr 30, 2020
@dpetrick
Copy link
Contributor

dpetrick commented May 4, 2020

Not reproducible on latest alpha, can you confirm this is fixed?

@timsuchanek
Copy link
Contributor Author

This is indeed fixed with the latest alpha!
Thanks!

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. tech/engines/query engine Issue in the Query Engine tech/engines Issue for tech Engines.
Projects
None yet
Development

No branches or pull requests

3 participants