Florian
02/10/2022, 10:23 AMmodel Something {
id String @id @default(dbgenerated("nanoid(\'SMTH_\')"))
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
....other fields....
}
(All of them have that default dbgenerated thing for the id
column)
Whenever I try to do a migration using prisma migrate dev
the tool keeps trying to add the following SQL to the migration for all the tables:
ALTER TABLE "something" ALTER COLUMN "id" SET DEFAULT nanoid('SMTH_');
Even though it has been correctly set on the initial migration:
CREATE TABLE "something" (
"id" TEXT NOT NULL DEFAULT nanoid('SMTH_'),
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "something_pkey" PRIMARY KEY ("id")
);
I keep removing them by hand, but is it possible for it not to create that everytime? 😄
Btw, I'm using prisma@3.9.1
with postgres:10.13
, I can't tell if it happened on previous versions, I did my setup this week 😄