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

no entry found for key error on views<->model relations #19249

Open
jkomyno opened this issue May 15, 2023 · 1 comment · May be fixed by prisma/prisma-engines#5137
Open

no entry found for key error on views<->model relations #19249

jkomyno opened this issue May 15, 2023 · 1 comment · May be fixed by prisma/prisma-engines#5137
Labels
bug/2-confirmed Bug has been reproduced and confirmed. domain/schema Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc. kind/bug A reported bug. tech/engines Issue for tech Engines. topic: implicit m:n implicit many-to-many relations topic: previewFeatures Issue touches on an preview feature flag topic: relations topic: rust panic topic: views

Comments

@jkomyno
Copy link
Contributor

jkomyno commented May 15, 2023

Consider this valid Prisma schema:

datasource db {
  provider = "postgres"
  url = env("TEST_POSTGRES_URI_MIGRATE")
}

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["views"]
}

model Organization {
  id         Int        @id @default(autoincrement())
  name       String     @default("") @db.VarChar(255)
  view_users ViewUser[]
}

view ViewUser {
  user_id       Int            @id @unique
  name          String
  organizations Organization[]
}

With prisma@4.14.0, running

prisma migrate dev --create-only

results in the following Rust panic:

❯ npx prisma@4.14.0 migrate dev --create-only
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "tests-migrate" at "localhost:5432"

Oops, an unexpected error occurred!
Error in migration engine.
Reason: [schema-engine/connectors/sql-schema-connector/src/sql_schema_calculator.rs:198:32] no entry found for key

Also see: this internal error report.

@jkomyno jkomyno added tech/engines Issue for tech Engines. topic: rust panic domain/schema Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc. bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. labels May 15, 2023
@Jolg42 Jolg42 added topic: previewFeatures Issue touches on an preview feature flag topic: views labels May 15, 2023
@janpio janpio added topic: implicit m:n implicit many-to-many relations topic: relations labels May 16, 2023
@mayur-2345
Copy link

#19951

same issue faced by me

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. domain/schema Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc. kind/bug A reported bug. tech/engines Issue for tech Engines. topic: implicit m:n implicit many-to-many relations topic: previewFeatures Issue touches on an preview feature flag topic: relations topic: rust panic topic: views
Projects
None yet
4 participants