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

Error in schema.prisma for enums with multiple database schemas #23081

Closed
joelrb opened this issue Feb 12, 2024 · 1 comment
Closed

Error in schema.prisma for enums with multiple database schemas #23081

joelrb opened this issue Feb 12, 2024 · 1 comment
Labels
kind/bug A reported bug. topic: multiSchema multiple schemas

Comments

@joelrb
Copy link

joelrb commented Feb 12, 2024

Bug description

Why would an enum needs a schema? Error without it.

enum UserRole {
SUPERADMIN
ADMIN
USER
@@Schema("sc_users")
}

model User {
id String @id @default(cuid())
role UserRole
@@Schema("sc_users")
}

Screenshot 2024-02-12 170606

How to reproduce

Add models in prisma.schema file.

Expected behavior

No error for enums.

Prisma information

// Add your schema.prisma
// Add your code using Prisma Client

Environment & setup

  • OS: Windows
  • Database: PostgreSQL
  • Node.js version: v21.5.0
  • NextJS version: v14

Prisma Version

^5.9.1
@joelrb joelrb added the kind/bug A reported bug. label Feb 12, 2024
@jkomyno
Copy link
Contributor

jkomyno commented Feb 12, 2024

Hi @joelrb, what you're reporting is working as intended. ENUM declarations are not global: they live in a database schema. Hence, indicating which schema they belong to is required when working with multiple database schemas, like in your case.

I hope this helps! I'm closing this as "not an issue", but if you have further comments, please add them below here. Thanks :)

@jkomyno jkomyno closed this as not planned Won't fix, can't repro, duplicate, stale Feb 12, 2024
@janpio janpio added the topic: multiSchema multiple schemas label Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A reported bug. topic: multiSchema multiple schemas
Projects
None yet
Development

No branches or pull requests

3 participants