fjuk
fjuk
PPrisma
Created by fjuk on 7/10/2024 in #help-and-questions
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"))
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';
5 replies
PPrisma
Created by fjuk on 5/19/2024 in #help-and-questions
Unique index w/ nullable field in unique query
I'm having an issue with a unique index where one of the fields is a nullable field (deleted at) When attempting to findUnique or upsert with the unique index, I'm unable to use it with the value of null (which should get me the only row that's not deleted if there's one). Instead, it errors, saying that the value must not be null and must be a proper date I'm not really sure how to go around this, since I can't separate the where clause to name and deletedAt since I'm required to use unique field(s)
7 replies
PPrisma
Created by fjuk on 3/17/2024 in #help-and-questions
how to create the _prisma_migration table in a specific schema?
I do not have perms on the Public schema due to how the db and its perms are set up. Is there a way to config prisma so that the migrations table will be created in a different schema? For example, under a "prisma" schema or something like that?
5 replies