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

regression: nested create/connect in delegate model requires reference fields #1894

Closed
chunkerchunker opened this issue Nov 27, 2024 · 1 comment

Comments

@chunkerchunker
Copy link
Contributor

Zenstack version 2.8.0 changed the type signature for nested creates/connects on delegates, incorrectly requiring referenced identifiers.

With the following schema:

model A {
  id Int @id @default(autoincrement())
  b  B[]
}

model B {
  id   Int    @id @default(autoincrement())
  a    A      @relation(fields: [aId], references: [id])
  aId  Int

  type String
  @@delegate(type)
}

model C extends B {
  f String?
}

I expect to be able to call something like:

db.c.create({ data: { a: { connect: { id: 0 } } } });

But as of version 2.8.0, Zenstack defines the data signature (in the generated .logical-prisma-client/runtime/index-fixed.d.ts) as the following (requiring the aId reference property):

export type CCreateInput = {
    aId: number

    f?: string | null
    a: ACreateNestedOneWithoutDelegate_aux_A_b_CInput
};

In previous versions, Zenstack defined it as expected:

export type CCreateInput = {

    f?: string | null
    a: ACreateNestedOneWithoutDelegate_aux_A_b_CInput
};

Environment:

  • ZenStack version: >= 2.8.0
  • Prisma version: any
  • Database type: any
@ymc9
Copy link
Member

ymc9 commented Dec 5, 2024

fixed in 2.10.0

@ymc9 ymc9 closed this as completed Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants