Skip to content

enum ignores mapping #315

@DoctorFTB

Description

@DoctorFTB

Enum:

enum UserRole {
  ADMIN @map("admin")
  USER @map("user")

  @@map("user_role")
}
  1. Enum values ​​should be lowercase admin/user, but in the database they appear in uppercase. SQLite uses TEXT type for enums and adds ADMIN. PostgreSQL returns an error because SQL uses an uppercase value.
  2. The schema file is missing information about the value map/enumeration attributes (e.g., value ADMIN has @map attribute with value admin, or enum UserRole has an @map attribute with value user_role).

Repo with sqlite (inserting via zenstack, getting updated data via the raw better-sqlite library to prevent kysely/zenstack mapping): https://github.com/DoctorFTB/zenstack-v3-enum-bug
If needed, I can also create a repo with PostgreSQL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions