PrismaP
Prisma2y ago
4 replies
fjuk

Date field default value

I have a use case for a date field that has a default value, for the sake of the question, it'll be 1970-01-01.

In my prisma file it is set as follows:

field DateTime @db.Timestampz(3) @default(dbgenerated("1970-01-01"))


Thr migration itself works just fine, but rverytime I try to create a new migration, it is filled again and again with alter tables for setting the default value

ALTER TABLE schema.table_name ALTER COLUMN "field" SET DEFAULT '1970-01-01';
Was this page helpful?