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

Getting dbgenerated() for defaults on enums in Postgres #2689

Closed
matthewmueller opened this issue Jun 8, 2020 · 1 comment · Fixed by prisma/prisma-engines#794
Closed
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. topic: introspection
Milestone

Comments

@matthewmueller
Copy link
Contributor

Bug description

Introspection on Postgres enums with a default value yields dbgenerated()

How to reproduce

Given the following Postgres statements:

CREATE SCHEMA "postgres-env$dev";
CREATE TABLE "postgres-env$dev"."User" (
    id character varying(25) NOT NULL PRIMARY KEY,
    role text NOT NULL
);
CREATE TYPE "postgres-env$dev"."Role" AS ENUM ('ADMIN', 'CUSTOMER');
ALTER TABLE "postgres-env$dev"."User" ALTER COLUMN "role" SET DATA TYPE "postgres-env$dev"."Role" using "role"::"postgres-env$dev"."Role";

Given the following prisma.schema:

datasource db {
  provider = "postgresql"
  url      = "postgres://user@localhost:5432/prisma_test?schema=postgres-env%24dev"
}

When I run introspect, I get

model User {
  id       String   @default(cuid()) @id
  role     Role     @default(dbgenerated())
}
@matthewmueller matthewmueller added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. topic: introspection labels Jun 8, 2020
@do4gr do4gr self-assigned this Jun 8, 2020
@janpio janpio added the kind/bug A reported bug. label Jun 8, 2020
@pantharshit00 pantharshit00 added 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 Jun 10, 2020
@pantharshit00
Copy link
Contributor

I can confirm this, looks like @do4gr is already working on this

@janpio janpio added this to the 2.1.0 milestone Jun 10, 2020
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. topic: introspection
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants