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

@@map not working on postgress enums starting version 4.6.0 #16209

Closed
Siegrift opened this issue Nov 9, 2022 · 2 comments
Closed

@@map not working on postgress enums starting version 4.6.0 #16209

Siegrift opened this issue Nov 9, 2022 · 2 comments
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. topic: enum "type"/block `enum`
Milestone

Comments

@Siegrift
Copy link

Siegrift commented Nov 9, 2022

Bug description

The latest prisma@4.6.0 stops recognizing @@map expressions on enums, while prisma@4.5.0 does.

How to reproduce

This is my schema.prisma file:

datasource db {
  url      = "postgresql://postgres:password@localhost:5432/postgres"
  provider = "postgresql"
}

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

model Table {
  id    String @id
  field MyEnum

  @@map("table")
}

enum MyEnum {
  A
  B

  @@map("my_enum")
}

When I create a migration with prisma@4.6.0 using npx prisma migrate dev --name initial --create-only I get the following:

-- CreateEnum
CREATE TYPE "MyEnum" AS ENUM ('A', 'B');

-- CreateTable
CREATE TABLE "table" (
    "id" TEXT NOT NULL,
    "field" "MyEnum" NOT NULL,

    CONSTRAINT "table_pkey" PRIMARY KEY ("id")
);

When I create a migration with prisma@4.5.0 using npx prisma migrate dev --name initial --create-only I get the following:

-- CreateEnum
CREATE TYPE "my_enum" AS ENUM ('A', 'B');

-- CreateTable
CREATE TABLE "table" (
    "id" TEXT NOT NULL,
    "field" "my_enum" NOT NULL,

    CONSTRAINT "table_pkey" PRIMARY KEY ("id")
);

Expected behavior

The same migration as with version 4.5.0.

Prisma information

already shared.

Environment & setup

  • OS: macOS
  • Database: PostgreSQL
  • Node.js version: 18.12.1

Prisma Version

4.6.0
@Siegrift Siegrift added the kind/bug A reported bug. label Nov 9, 2022
@alexisbellido
Copy link

Could this be related to #16180 ?

@SevInf SevInf added team/schema Issue for team Schema. bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. topic: enum "type"/block `enum` bug/2-confirmed Bug has been reproduced and confirmed. and removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels Nov 10, 2022
@SevInf
Copy link
Contributor

SevInf commented Nov 10, 2022

Confirmed as duplicate of #16180.
I am going to close this issue, you can follow the progress in #16180. Patch version with a fix would be published later today.

@SevInf SevInf closed this as completed Nov 10, 2022
@janpio janpio added this to the 4.7.0 milestone Nov 10, 2022
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. topic: enum "type"/block `enum`
Projects
None yet
Development

No branches or pull requests

4 participants