initial commit

This commit is contained in:
2026-04-03 18:25:54 +01:00
commit 17e26fc87f
35 changed files with 4716 additions and 0 deletions

43
prisma/schema.prisma Normal file
View File

@@ -0,0 +1,43 @@
generator client {
provider = "prisma-client"
output = "../generated/prisma"
}
datasource db {
provider = "mysql"
}
model Pet {
id Int @id @default(autoincrement())
name String
species String
userId String
posts Post[] // One pet can have many posts
sentRequests Friendship[] @relation("sentRequests")
receivedRequests Friendship[] @relation("receivedRequests")
}
model Friendship {
id Int @id @default(autoincrement())
petId Int
friendId Int
pet Pet @relation("sentRequests", fields: [petId], references: [id])
friend Pet @relation("receivedRequests", fields: [friendId], references: [id])
accepted Boolean @default(false)
createdAt DateTime @default(now())
// 3. Safety: A pet can't friend the same pet twice
@@unique([petId, friendId])
}
model Post {
id Int @id @default(autoincrement())
content String
petId Int @map("pet_id")
pet Pet @relation(fields: [petId], references: [id])
}