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

bug: vscode extension does not show a warning about manually adding an index when using relationMode = "prisma" #1400

Open
smashboy opened this issue Apr 12, 2023 · 0 comments
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. tech/engines/formatter engine Issue in the Formatter Engine topic: diagnostics topic: referentialIntegrity/relationMode

Comments

@smashboy
Copy link

Bug description

Hello everyone! I'm using relationMode = "prisma" and one of the models has two relations to the same model, but for some reason vscode doesn't show a warning for one of those relationships. This issue comes from the following discussion: prisma/prisma#18687

If both of these relations have no index, there is only one warning:

image

If I fix the only warning that exists, the second warning still doesn't appear:

image

How to reproduce

Copy the prisma schema below to vscode.

Expected behavior

Both relations have warnings.

Prisma information

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider          = "mysql"
  url               = env("DATABASE_URL")
  shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
  relationMode      = "prisma"
}

model User {
  id        String         @id @default(cuid())
  createdAt DateTime       @default(value: now())
  updatedAt DateTime       @updatedAt
  name      String?
  followers UserFollower[] @relation("following")
  following UserFollower[] @relation("followers")
}

model UserFollower {
  createdAt       DateTime @default(value: now())
  updatedAt       DateTime @updatedAt
  following       User     @relation("following", fields: [followingUserId], references: [id])
  followingUserId String
  follower        User     @relation("followers", fields: [followerUserId], references: [id]) // only this relation has a warning
  followerUserId  String

  @@unique([followingUserId, followerUserId])
}

Environment & setup

  • OS: Windows
  • Editor: VSCode
  • Editor version: 1.70.0
  • Extension version: v4.12.0
  • Prisma version: 4.11.0
@Jolg42 Jolg42 added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/schema Issue for team Schema. topic: referentialIntegrity/relationMode topic: diagnostics labels Apr 26, 2023
@Druue Druue added bug/2-confirmed Bug has been reproduced and confirmed. tech/engines/formatter engine Issue in the Formatter Engine and removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. tech/engines/formatter engine Issue in the Formatter Engine topic: diagnostics topic: referentialIntegrity/relationMode
Projects
None yet
Development

No branches or pull requests

3 participants