Bug description
I am trying to migrate from Prisma1 to Prisma2.
When I introspect the database, default values are not generated in the output schema.
How to reproduce
Here is my database schema:
CREATE TABLE "default$default"."User"
(
id character varying(25) COLLATE pg_catalog."default" NOT NULL,
isActive boolean NOT NULL,
CONSTRAINT "User_pkey" PRIMARY KEY (id)
)
Database schema has no DEFAULT constraint defined for the column isActive so it seems logical that there is no @default attribute in the datamodel after the introspection (Prisma2).
However, it works fine with the Prisma1 introspection where the generated datamodel has the @default attributes.
The introspected schema:
model User {
id String @id
isActive Boolean
}
Expected behavior
I was expecting the following Prisma2 schema:
model User {
id String @id @default(cuid())
isActive Boolean @default(true)
}
Same behaviour with the @createdAt and @updatedAt directives.
Where are defined (or stored) these constraints in the underlying database when using Prisma1 ?
Environment & setup
Bug description
I am trying to migrate from Prisma1 to Prisma2.
When I introspect the database, default values are not generated in the output schema.
How to reproduce
Here is my database schema:
Database schema has no
DEFAULTconstraint defined for the columnisActiveso it seems logical that there is no@defaultattribute in the datamodel after the introspection (Prisma2).However, it works fine with the Prisma1 introspection where the generated datamodel has the
@defaultattributes.The introspected schema:
Expected behavior
I was expecting the following Prisma2 schema:
Same behaviour with the
@createdAtand@updatedAtdirectives.Where are defined (or stored) these constraints in the underlying database when using Prisma1 ?
Environment & setup