generator client { provider = "prisma-client-js" } datasource db { provider = "postgresql" url = env("DATABASE_URL") } model User { id Int @id @default(autoincrement()) name String email String @unique pets Pet[] posts Post[] following Follow[] @relation("Follower") followers Follow[] @relation("Following") createdAt DateTime @default(now()) notifications Notification[] } model Pet { id Int @id @default(autoincrement()) name String type String // "Hund" | "Katze" breed String birthDate DateTime? // ⭐ Single Source of Truth für Alter gender String? bio String? avatarUrl String? visibility String @default("public") // public | followers ownerId Int owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade) posts Post[] } model Post { id Int @id @default(autoincrement()) content String? createdAt DateTime @default(now()) petId Int pet Pet @relation(fields: [petId], references: [id], onDelete: Cascade) authorId Int author User @relation(fields: [authorId], references: [id], onDelete: Cascade) } model Follow { id Int @id @default(autoincrement()) followerId Int follower User @relation("Follower", fields: [followerId], references: [id], onDelete: Cascade) followingId Int following User @relation("Following", fields: [followingId], references: [id], onDelete: Cascade) createdAt DateTime @default(now()) @@unique([followerId, followingId]) } model Notification { id Int @id @default(autoincrement()) type String // 'FOLLOW' | 'BIRTHDAY' payload Json read Boolean @default(false) userId Int user User @relation(fields: [userId], references: [id], onDelete: Cascade) createdAt DateTime @default(now()) }