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

feat: Quick Fix - relationMode : missing foreign keys' indexes #1297

Closed
Druue opened this issue Nov 21, 2022 · 0 comments · Fixed by prisma/prisma-engines#3431
Closed

feat: Quick Fix - relationMode : missing foreign keys' indexes #1297

Druue opened this issue Nov 21, 2022 · 0 comments · Fixed by prisma/prisma-engines#3431
Assignees
Labels
kind/improvement An improvement to existing feature and code. team/schema Issue for team Schema. tech/engines Issue for tech Engines. topic: quick fix
Milestone

Comments

@Druue
Copy link
Contributor

Druue commented Nov 21, 2022

Per implementation of #1296 a warning will be displayed given a field being referenced within an @relation that hasn't been referenced inside of an @@index clause. This could be quick-fixable.
Internal Reference Doc

--- Before ---

# relationMode = "prisma"

model OrderHistory {
  id        Int      @id
  order     Order    @relation(fields: [orderId], references: [orderId])
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # Warning Squiggly
  orderId   String
}

--- After ---

model OrderHistory {
  id        Int      @id
  order     Order    @relation(fields: [orderId], references: [orderId])
  orderId   String
  
  @@index([orderId])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/improvement An improvement to existing feature and code. team/schema Issue for team Schema. tech/engines Issue for tech Engines. topic: quick fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant