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

EPIC: Multi field id criterion (Multi column PKs) #29

Closed
5 tasks done
janpio opened this issue Sep 6, 2019 · 3 comments
Closed
5 tasks done

EPIC: Multi field id criterion (Multi column PKs) #29

janpio opened this issue Sep 6, 2019 · 3 comments

Comments

@janpio
Copy link
Member

janpio commented Sep 6, 2019

Spec: The relevant part of the spec on the Prisma Schema Language can be found here.

Description: The Prisma Schema Language allows the user to define a combination of fields as the id criterion. It is an implementation detail of a connector how this is implemented.

Example:
The following example shows a User model where the combination of firstName and lastName is the id criterion.

model User {
  firstName String
  lastName  String
  @@id([firstName, lastName])
}

Affected Components

  • Datamodel Parser
  • Migration Engine
  • Query Engine
  • Introspection Engine

Links to actual Work Packages

@mavilein mavilein changed the title Multi field id criterion (Multi column PKs) EPIC: Multi field id criterion (Multi column PKs) Sep 25, 2019
@mavilein
Copy link
Member

Initial break down of Work Packages

  • Datamodel Parser
    • extend Model data structure in dml module to store informations on multi field ids
    • implement new DirectiveValidator for @@id
    • test cases:
      • basic happy path
      • name arg must not be optional
      • the directive must not refer to undefined fields
      • a model must either have @id or @@id
  • Migration Engine
    • core: implement new migration steps for indexes (diffing + applying)
    • sql connector:
      • calculation of sql schema
      • diffing of sql schemas
      • add SQL rendering to database step applier
  • Query Engine
    • core:
      • adapt Schema so it can accept a combination fields as id criteria=on
      • adapt all places that expect an id to be a single PrismaValue
    • connector:
      • adapt all places that expect an id to be a single PrismaValue
  • Introspection Engine:
    • core: no work required
    • connector:
      • verify that the sql-schema-describer can handle compound ids
      • adapt Datamodel calculation so that compound ids are translated to @@id in a model

@mavilein
Copy link
Member

Open Questions

  • the GraphQL protocol for the communication between photon client and query engine must be defined

@mavilein
Copy link
Member

I asked for a spec for the Photon API in this issue.

@mavilein mavilein added this to the Preview 15 milestone Oct 14, 2019
@mavilein mavilein removed this from the Preview 15 milestone Oct 14, 2019
miguelff pushed a commit that referenced this issue Apr 20, 2023
Handle more errors (MySQL, Postgres)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants