45 lines
1.6 KiB
Plaintext
45 lines
1.6 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
url = "file:./dev.db"
|
|
}
|
|
|
|
model FriendRequest {
|
|
id Int @id @default(autoincrement())
|
|
senderUsername String
|
|
receiverUsername String
|
|
status String @default("pending") // Allowed values: "pending", "accepted", "rejected"
|
|
createdAt DateTime @default(now())
|
|
|
|
sender user @relation("SentRequests", fields: [senderUsername], references: [username])
|
|
receiver user @relation("ReceivedRequests", fields: [receiverUsername], references: [username])
|
|
}
|
|
|
|
model Message {
|
|
id Int @id @default(autoincrement())
|
|
content String
|
|
nonce String
|
|
senderUsername String
|
|
receiverUsername String
|
|
createdAt DateTime @default(now())
|
|
pubKey String
|
|
sender user @relation("SentMessages", fields: [senderUsername], references: [username])
|
|
receiver user @relation("ReceivedMessages", fields: [receiverUsername], references: [username])
|
|
}
|
|
|
|
model user {
|
|
username String @id
|
|
email String @unique
|
|
password String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
pubKey String @unique
|
|
sentMessages Message[] @relation("SentMessages")
|
|
receivedMessages Message[] @relation("ReceivedMessages")
|
|
sentRequests FriendRequest[] @relation("SentRequests")
|
|
receivedRequests FriendRequest[] @relation("ReceivedRequests")
|
|
}
|