From c410ad05ee0bd1a65be9668a80daf054e7de9a48 Mon Sep 17 00:00:00 2001 From: Gsk54 Date: Wed, 14 Dec 2022 12:10:27 +0100 Subject: [PATCH] add createdAt, updatedAt --- .../migration.sql | 9 +++++---- prisma/schema.prisma | 6 ++++-- 2 files changed, 9 insertions(+), 6 deletions(-) rename prisma/migrations/{20221214094628_init => 20221214110358_init}/migration.sql (52%) diff --git a/prisma/migrations/20221214094628_init/migration.sql b/prisma/migrations/20221214110358_init/migration.sql similarity index 52% rename from prisma/migrations/20221214094628_init/migration.sql rename to prisma/migrations/20221214110358_init/migration.sql index 9f7f21e..eea1424 100644 --- a/prisma/migrations/20221214094628_init/migration.sql +++ b/prisma/migrations/20221214110358_init/migration.sql @@ -3,11 +3,12 @@ CREATE TABLE "user" ( "uuid" UUID NOT NULL, "firstName" TEXT NOT NULL, "lastName" TEXT NOT NULL, - "email" TEXT NOT NULL + "email" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "user_pkey" PRIMARY KEY ("uuid") ); --- CreateIndex -CREATE UNIQUE INDEX "user_uuid_key" ON "user"("uuid"); - -- CreateIndex CREATE UNIQUE INDEX "user_email_key" ON "user"("email"); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index e6c2677..5c56f48 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -11,10 +11,12 @@ datasource db { } model User { - uuid String @unique @default(uuid()) @db.Uuid + uuid String @id @default(uuid()) @db.Uuid firstName String lastName String - email String @unique + email String @unique + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt @@map("user") }