diff --git a/prisma/dev.db b/prisma/dev.db index 1efd89d..c2edea9 100644 Binary files a/prisma/dev.db and b/prisma/dev.db differ diff --git a/prisma/dev.db-journal b/prisma/dev.db-journal index 5148a4c..bf77469 100644 Binary files a/prisma/dev.db-journal and b/prisma/dev.db-journal differ diff --git a/prisma/migrations/20230929083231_init/migration.sql b/prisma/migrations/20230929083231_init/migration.sql new file mode 100644 index 0000000..004aae3 --- /dev/null +++ b/prisma/migrations/20230929083231_init/migration.sql @@ -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"); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index df12926..d4382c4 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -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