Initial commit: Projektstruktur mit Next.js, Prisma, tRPC, shadcn/ui, Landingpage und Registrierung
This commit is contained in:
69
prisma/migrations/20250406193831_init/migration.sql
Normal file
69
prisma/migrations/20250406193831_init/migration.sql
Normal file
@@ -0,0 +1,69 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "User" (
|
||||
"id" TEXT NOT NULL,
|
||||
"email" TEXT NOT NULL,
|
||||
"name" TEXT,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Child" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"birthDate" TIMESTAMP(3) NOT NULL,
|
||||
"userId" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "Child_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Measurement" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"childId" INTEGER NOT NULL,
|
||||
"date" TIMESTAMP(3) NOT NULL,
|
||||
"weightKg" DOUBLE PRECISION,
|
||||
"heightCm" DOUBLE PRECISION,
|
||||
|
||||
CONSTRAINT "Measurement_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "ToothStatus" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"childId" INTEGER NOT NULL,
|
||||
"toothLabel" TEXT NOT NULL,
|
||||
"date" TIMESTAMP(3) NOT NULL,
|
||||
"status" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "ToothStatus_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Vaccine" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"childId" INTEGER NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"date" TIMESTAMP(3) NOT NULL,
|
||||
"done" BOOLEAN NOT NULL DEFAULT false,
|
||||
"notes" TEXT,
|
||||
|
||||
CONSTRAINT "Vaccine_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Child" ADD CONSTRAINT "Child_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Measurement" ADD CONSTRAINT "Measurement_childId_fkey" FOREIGN KEY ("childId") REFERENCES "Child"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "ToothStatus" ADD CONSTRAINT "ToothStatus_childId_fkey" FOREIGN KEY ("childId") REFERENCES "Child"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Vaccine" ADD CONSTRAINT "Vaccine_childId_fkey" FOREIGN KEY ("childId") REFERENCES "Child"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
3
prisma/migrations/migration_lock.toml
Normal file
3
prisma/migrations/migration_lock.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (e.g., Git)
|
||||
provider = "postgresql"
|
||||
61
prisma/schema.prisma
Normal file
61
prisma/schema.prisma
Normal file
@@ -0,0 +1,61 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
||||
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
model User {
|
||||
id String @id @default(uuid())
|
||||
email String @unique
|
||||
name String?
|
||||
children Child[]
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model Child {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
birthDate DateTime
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
measurements Measurement[]
|
||||
teeth ToothStatus[]
|
||||
vaccines Vaccine[]
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model Measurement {
|
||||
id Int @id @default(autoincrement())
|
||||
childId Int
|
||||
child Child @relation(fields: [childId], references: [id])
|
||||
date DateTime
|
||||
weightKg Float?
|
||||
heightCm Float?
|
||||
}
|
||||
|
||||
model ToothStatus {
|
||||
id Int @id @default(autoincrement())
|
||||
childId Int
|
||||
child Child @relation(fields: [childId], references: [id])
|
||||
toothLabel String // z. B. "oben links 1" oder "Zahn 61"
|
||||
date DateTime
|
||||
status String // z. B. "durchgebrochen", "locker", "fehlend"
|
||||
}
|
||||
|
||||
model Vaccine {
|
||||
id Int @id @default(autoincrement())
|
||||
childId Int
|
||||
child Child @relation(fields: [childId], references: [id])
|
||||
name String
|
||||
date DateTime
|
||||
done Boolean @default(false)
|
||||
notes String?
|
||||
}
|
||||
Reference in New Issue
Block a user