edited the user, added the event and editet the Post to Auftrag

This commit is contained in:
TimKapitza 2023-09-29 10:33:23 +02:00
parent edcba539de
commit 4d97c9d08d
4 changed files with 46 additions and 3 deletions

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,33 @@
/*
Warnings:
- You are about to drop the `Post` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropTable
PRAGMA foreign_keys=off;
DROP TABLE "Post";
PRAGMA foreign_keys=on;
-- CreateTable
CREATE TABLE "Event" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"date" TEXT NOT NULL,
"time" TEXT NOT NULL,
"location" TEXT NOT NULL
);
-- CreateTable
CREATE TABLE "Auftrag" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"title" TEXT NOT NULL,
"ticket" TEXT,
"eventID" INTEGER NOT NULL,
"published" BOOLEAN NOT NULL DEFAULT false,
"authorId" INTEGER NOT NULL,
CONSTRAINT "Auftrag_eventID_fkey" FOREIGN KEY ("eventID") REFERENCES "Event" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "Auftrag_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "Auftrag_eventID_key" ON "Auftrag"("eventID");

View File

@ -14,13 +14,23 @@ model User {
id Int @id @default(autoincrement())
email String @unique
name String?
posts Post[]
posts Auftrag[]
}
model Post {
model Event {
id Int @id @default(autoincrement())
date String
time String
location String
Auftrag Auftrag?
}
model Auftrag {
id Int @id @default(autoincrement())
title String
content String?
ticket String?
event Event @relation(fields: [eventID],references: [id])
eventID Int @unique
published Boolean @default(false)
author User @relation(fields: [authorId], references: [id])
authorId Int