diff --git a/prisma/migrations/20241102021258_init/migration.sql b/prisma/migrations/20241102021258_init/migration.sql new file mode 100644 index 0000000..ee71cc0 --- /dev/null +++ b/prisma/migrations/20241102021258_init/migration.sql @@ -0,0 +1,11 @@ +-- CreateTable +CREATE TABLE "todo" ( + "id" UUID NOT NULL DEFAULT gen_random_uuid(), + "name" TEXT NOT NULL, + "user_id" UUID NOT NULL, + + CONSTRAINT "todo_pkey" PRIMARY KEY ("id") +); + +-- AddForeignKey +ALTER TABLE "todo" ADD CONSTRAINT "todo_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "account"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index ebdd7d1..44cee97 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -18,6 +18,16 @@ datasource db { model User { id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid name String + Todo Todo[] @@map("account") } + +model Todo { + id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid + name String + user User @relation(fields: [userId], references: [id]) + userId String @map("user_id") @db.Uuid + + @@map("todo") +}