feat: update database schema to use snake_case for table names and add mapping for models
This commit is contained in:
@@ -24,6 +24,8 @@ model User {
|
||||
groupsMember Member[]
|
||||
groupsOwner Group[] @relation("OwnerGroups")
|
||||
waitlist WaitlistEntry[]
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
|
||||
model Account {
|
||||
@@ -44,6 +46,7 @@ model Account {
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([providerId, providerAccountId])
|
||||
@@map("accounts")
|
||||
}
|
||||
|
||||
model Session {
|
||||
@@ -57,6 +60,8 @@ model Session {
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("sessions")
|
||||
}
|
||||
|
||||
model Verification {
|
||||
@@ -68,6 +73,7 @@ model Verification {
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([identifier, value])
|
||||
@@map("verifications")
|
||||
}
|
||||
|
||||
// Domain models
|
||||
@@ -83,6 +89,8 @@ model Group {
|
||||
members Member[]
|
||||
students Student[]
|
||||
payments Payment[]
|
||||
|
||||
@@map("groups")
|
||||
}
|
||||
|
||||
model Member {
|
||||
@@ -96,6 +104,7 @@ model Member {
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([groupId, userId])
|
||||
@@map("members")
|
||||
}
|
||||
|
||||
enum Role {
|
||||
@@ -120,6 +129,7 @@ model Student {
|
||||
payments Payment[]
|
||||
|
||||
@@index([groupId])
|
||||
@@map("students")
|
||||
}
|
||||
|
||||
model Payment {
|
||||
@@ -139,6 +149,7 @@ model Payment {
|
||||
|
||||
@@index([groupId])
|
||||
@@index([studentId])
|
||||
@@map("payments")
|
||||
}
|
||||
|
||||
enum PaymentStatus {
|
||||
@@ -161,6 +172,7 @@ model WaitlistEntry {
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@unique([email])
|
||||
@@map("waitlist_entries")
|
||||
}
|
||||
|
||||
enum WaitlistStatus {
|
||||
|
||||
Reference in New Issue
Block a user