#1 Schema adjusted

Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
Benny Samir Hierl 2022-02-05 14:45:56 +01:00
parent 82ac242d96
commit 56db8ba65a
2 changed files with 10 additions and 10 deletions

View file

@ -4,17 +4,17 @@ CREATE TABLE "Wishlist" (
"title" TEXT NOT NULL, "title" TEXT NOT NULL,
"imageSrc" TEXT NOT NULL, "imageSrc" TEXT NOT NULL,
"slugUrlText" TEXT NOT NULL, "slugUrlText" TEXT NOT NULL,
"description" TEXT "description" TEXT NOT NULL DEFAULT ''
); );
-- CreateTable -- CreateTable
CREATE TABLE "Item" ( CREATE TABLE "Item" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"title" TEXT NOT NULL, "title" TEXT NOT NULL,
"url" TEXT, "url" TEXT NOT NULL DEFAULT '',
"imageSrc" TEXT, "imageSrc" TEXT NOT NULL DEFAULT '',
"description" TEXT NOT NULL, "description" TEXT NOT NULL,
"comment" TEXT, "comment" TEXT NOT NULL DEFAULT '',
"bought" BOOLEAN NOT NULL DEFAULT false, "bought" BOOLEAN NOT NULL DEFAULT false,
"wishlistId" TEXT NOT NULL, "wishlistId" TEXT NOT NULL,
CONSTRAINT "Item_wishlistId_fkey" FOREIGN KEY ("wishlistId") REFERENCES "Wishlist" ("id") ON DELETE RESTRICT ON UPDATE CASCADE CONSTRAINT "Item_wishlistId_fkey" FOREIGN KEY ("wishlistId") REFERENCES "Wishlist" ("id") ON DELETE RESTRICT ON UPDATE CASCADE

View file

@ -15,17 +15,17 @@ model Wishlist {
title String title String
imageSrc String imageSrc String
slugUrlText String @unique slugUrlText String @unique
description String? description String @default("")
items Item[] items Item[]
} }
model Item { model Item {
id Int @id @default(autoincrement()) id Int @id @default(autoincrement())
title String title String
url String? url String @default("")
imageSrc String? imageSrc String @default("")
description String description String
comment String? comment String @default("")
bought Boolean @default(false) bought Boolean @default(false)
wishlist Wishlist @relation(fields: [wishlistId], references: [id]) wishlist Wishlist @relation(fields: [wishlistId], references: [id])
wishlistId String wishlistId String