Skip to content

[Feature request] Support implicit inversed relationship #613

@jiashengguo

Description

@jiashengguo

Support the below schema:

model User {
  id    Int    @id @default(autoincrement())
 // posts Post[].    no need to specify it in Zmodel,  ZenStack will generate it in the schema.prisma file.
}

model Post {
  id       Int  @id @default(autoincrement())
  author   User @relation(fields: [authorId], references: [id])
  authorId Int
}

Need naming convention rule to generate the inversed relation. Also, need a way to distinguish between one-to-one and one-to-many.

Take a reference of how EF handles it:
https://learn.microsoft.com/en-us/ef/core/modeling/relationships/one-to-one#one-to-one-without-navigation-to-dependent

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      close