[go: nahoru, domu]

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

*Many queries does not support creation of implicit m-m tables #24696

Open
musjj opened this issue Jul 3, 2024 · 0 comments
Open

*Many queries does not support creation of implicit m-m tables #24696

musjj opened this issue Jul 3, 2024 · 0 comments
Labels
domain/client Issue in the "Client" domain: Prisma Client, Prisma Studio etc. kind/feature A request for a new feature. tech/engines Issue for tech Engines. topic: createMany nested `createMany` topic: implicit m:n implicit many-to-many relations topic: m:n many-to-many relations topic: updateMany nested updateMany

Comments

@musjj
Copy link
musjj commented Jul 3, 2024

Bug description

createMany, createManyAndReturn, or updateMany does not allow the creation of implicit m-m tables.

How to reproduce

Works:

const createPostAndCategory = await prisma.post.create({
  data: {
    title: 'How to become a butterfly',
    categories: {
      create: [{ name: 'Magic' }, { name: 'Butterflies' }],
    },
  },
})

Doesn't:

const createPostAndCategory = await prisma.post.createMany({
  data: [
    {
      categories: // Object literal may only specify known properties
    }
  ]
})

Expected behavior

Implicit m-m tables can be created using createMany, createManyAndReturn, or updateMany.

Prisma information

From: https://www.prisma.io/docs/orm/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations

model Post {
  id         Int        @id @default(autoincrement())
  title      String
  categories Category[]
}

model Category {
  id    Int    @id @default(autoincrement())
  name  String
  posts Post[]
}

Environment & setup

  • OS: Linux
  • Database: PostgreSQL
  • Node.js version: v20.12.2

Prisma Version

prisma                  : 5.16.1
@prisma/client          : 5.16.1
Computed binaryTarget   : linux-nixos
Operating System        : linux
Architecture            : x64
Node.js                 : v20.12.2
Query Engine (Node-API) : libquery-engine 34ace0eb2704183d2c05b60b52fba5c43c13f303 (at ../../../../../nix/store/nknr29vd7zphq39hzlw8dx3kqs9bjd75-prisma-bin-34ace0eb2704183d2c05b60b52fba5c43c13f303/lib/libquery_engine.node, resolved by PRISMA_QUERY_ENGINE_LIBRARY)
Schema Engine           : schema-engine-cli 34ace0eb2704183d2c05b60b52fba5c43c13f303 (at ../../../../../nix/store/nknr29vd7zphq39hzlw8dx3kqs9bjd75-prisma-bin-34ace0eb2704183d2c05b60b52fba5c43c13f303/bin/schema-engine, resolved by PRISMA_SCHEMA_ENGINE_BINARY)
Schema Wasm             : @prisma/prisma-schema-wasm 5.16.0-24.34ace0eb2704183d2c05b60b52fba5c43c13f303
Default Engines Hash    : 34ace0eb2704183d2c05b60b52fba5c43c13f303
Studio                  : 0.502.0
Preview Features        : fullTextSearch
@musjj musjj added the kind/bug A reported bug. label Jul 3, 2024
@musjj musjj changed the title createMany{,AndReturn} does not support creation of implicit m-m tables *Many queries does not support creation of implicit m-m tables Jul 3, 2024
@Weakky Weakky added kind/feature A request for a new feature. domain/client Issue in the "Client" domain: Prisma Client, Prisma Studio etc. tech/engines Issue for tech Engines. topic: createMany nested `createMany` topic: updateMany nested updateMany topic: implicit m:n implicit many-to-many relations topic: m:n many-to-many relations and removed kind/bug A reported bug. labels Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain/client Issue in the "Client" domain: Prisma Client, Prisma Studio etc. kind/feature A request for a new feature. tech/engines Issue for tech Engines. topic: createMany nested `createMany` topic: implicit m:n implicit many-to-many relations topic: m:n many-to-many relations topic: updateMany nested updateMany
Projects
None yet
Development

No branches or pull requests

2 participants