mirror of
https://github.com/aditama-labs/nest-autocrud.git
synced 2024-11-24 12:56:22 +00:00
feat: relation migration for sample custom relation support
This commit is contained in:
parent
5c083f3add
commit
606221dab3
11
prisma/migrations/20241102021258_init/migration.sql
Normal file
11
prisma/migrations/20241102021258_init/migration.sql
Normal file
@ -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;
|
@ -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")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user