2023-11-11 03:36:06 +01:00
|
|
|
generator client {
|
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
|
previewFeatures = ["postgresqlExtensions"]
|
2024-04-07 11:22:45 +02:00
|
|
|
// These last two lines are important for Docker!
|
2024-04-07 12:35:27 +02:00
|
|
|
binaryTargets = ["native", "debian-openssl-3.0.x", "linux-arm64-openssl-3.0.x"]
|
2023-11-11 03:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
2024-03-13 09:10:32 +01:00
|
|
|
generator json {
|
|
|
|
|
provider = "prisma-json-types-generator"
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-11 03:36:06 +01:00
|
|
|
datasource db {
|
|
|
|
|
provider = "postgresql"
|
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
|
extensions = [pg_uuidv7]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Application {
|
2023-12-07 00:34:56 +01:00
|
|
|
id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid
|
|
|
|
|
name String
|
|
|
|
|
website String?
|
|
|
|
|
vapid_key String?
|
|
|
|
|
client_id String @unique
|
|
|
|
|
secret String
|
|
|
|
|
scopes String
|
|
|
|
|
redirect_uris String
|
|
|
|
|
statuses Status[] // One to many relation with Status
|
|
|
|
|
tokens Token[] // One to many relation with Token
|
|
|
|
|
openIdLoginFlows OpenIdLoginFlow[]
|
2023-11-11 03:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Emoji {
|
|
|
|
|
id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid
|
|
|
|
|
shortcode String
|
|
|
|
|
url String
|
|
|
|
|
visible_in_picker Boolean
|
|
|
|
|
instance Instance? @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
|
|
|
|
instanceId String? @db.Uuid
|
|
|
|
|
alt String?
|
|
|
|
|
content_type String
|
|
|
|
|
users User[] // Many to many relation with User
|
|
|
|
|
statuses Status[] // Many to many relation with Status
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Instance {
|
2024-03-04 02:27:08 +01:00
|
|
|
id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid
|
|
|
|
|
base_url String
|
|
|
|
|
name String
|
|
|
|
|
version String
|
2024-03-13 09:10:32 +01:00
|
|
|
/// [InstanceLogo]
|
2024-03-04 02:27:08 +01:00
|
|
|
logo Json
|
|
|
|
|
emojis Emoji[] // One to many relation with Emoji
|
|
|
|
|
statuses Status[] // One to many relation with Status
|
|
|
|
|
users User[] // One to many relation with User
|
|
|
|
|
disableAutomoderation Boolean @default(false)
|
2023-11-11 03:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Like {
|
|
|
|
|
id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid
|
|
|
|
|
liker User @relation("UserLiked", fields: [likerId], references: [id], onDelete: Cascade)
|
|
|
|
|
likerId String @db.Uuid
|
|
|
|
|
liked Status @relation("LikedToStatus", fields: [likedId], references: [id], onDelete: Cascade)
|
|
|
|
|
likedId String @db.Uuid
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model LysandObject {
|
|
|
|
|
id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid
|
|
|
|
|
remote_id String @unique
|
|
|
|
|
type String
|
|
|
|
|
uri String @unique
|
|
|
|
|
created_at DateTime @default(now())
|
|
|
|
|
author LysandObject? @relation("LysandObjectToAuthor", fields: [authorId], references: [id], onDelete: Cascade)
|
|
|
|
|
authorId String? @db.Uuid
|
2024-03-13 09:10:32 +01:00
|
|
|
/// [ObjectData]
|
2023-11-11 03:36:06 +01:00
|
|
|
extra_data Json
|
2024-03-13 09:10:32 +01:00
|
|
|
/// [ObjectExtensions]
|
2023-11-11 03:36:06 +01:00
|
|
|
extensions Json
|
|
|
|
|
children LysandObject[] @relation("LysandObjectToAuthor")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Relationship {
|
|
|
|
|
id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid
|
|
|
|
|
owner User @relation("OwnerToRelationship", fields: [ownerId], references: [id], onDelete: Cascade)
|
|
|
|
|
ownerId String @db.Uuid
|
|
|
|
|
subject User @relation("SubjectToRelationship", fields: [subjectId], references: [id], onDelete: Cascade)
|
|
|
|
|
subjectId String @db.Uuid
|
|
|
|
|
following Boolean
|
|
|
|
|
showingReblogs Boolean
|
|
|
|
|
notifying Boolean
|
|
|
|
|
followedBy Boolean
|
|
|
|
|
blocking Boolean
|
|
|
|
|
blockedBy Boolean
|
|
|
|
|
muting Boolean
|
|
|
|
|
mutingNotifications Boolean
|
|
|
|
|
requested Boolean
|
|
|
|
|
domainBlocking Boolean
|
|
|
|
|
endorsed Boolean
|
|
|
|
|
languages String[]
|
|
|
|
|
note String
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Status {
|
2024-03-04 05:33:25 +01:00
|
|
|
id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid
|
2024-04-09 06:33:59 +02:00
|
|
|
uri String? @unique
|
2024-03-04 05:33:25 +01:00
|
|
|
author User @relation("UserStatuses", fields: [authorId], references: [id], onDelete: Cascade)
|
|
|
|
|
authorId String @db.Uuid
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
reblog Status? @relation("StatusToStatus", fields: [reblogId], references: [id], onDelete: Cascade)
|
|
|
|
|
reblogId String? @db.Uuid
|
2023-11-23 05:10:37 +01:00
|
|
|
isReblog Boolean
|
2024-03-04 05:33:25 +01:00
|
|
|
content String @default("")
|
|
|
|
|
contentType String @default("text/plain")
|
|
|
|
|
contentSource String @default("")
|
2023-11-23 05:10:37 +01:00
|
|
|
visibility String
|
2024-03-04 05:33:25 +01:00
|
|
|
inReplyToPost Status? @relation("StatusToStatusReply", fields: [inReplyToPostId], references: [id], onDelete: SetNull)
|
|
|
|
|
inReplyToPostId String? @db.Uuid
|
|
|
|
|
quotingPost Status? @relation("StatusToStatusQuote", fields: [quotingPostId], references: [id], onDelete: SetNull)
|
|
|
|
|
quotingPostId String? @db.Uuid
|
|
|
|
|
instance Instance? @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
|
|
|
|
instanceId String? @db.Uuid
|
2023-11-23 05:10:37 +01:00
|
|
|
sensitive Boolean
|
2024-03-04 05:33:25 +01:00
|
|
|
spoilerText String @default("")
|
|
|
|
|
application Application? @relation(fields: [applicationId], references: [id], onDelete: SetNull)
|
|
|
|
|
applicationId String? @db.Uuid
|
|
|
|
|
emojis Emoji[] @relation
|
2023-11-23 05:10:37 +01:00
|
|
|
mentions User[]
|
2024-03-04 05:33:25 +01:00
|
|
|
likes Like[] @relation("LikedToStatus")
|
|
|
|
|
reblogs Status[] @relation("StatusToStatus")
|
|
|
|
|
replies Status[] @relation("StatusToStatusReply")
|
|
|
|
|
quotes Status[] @relation("StatusToStatusQuote")
|
|
|
|
|
pinnedBy User[] @relation("UserPinnedNotes")
|
2023-11-23 05:10:37 +01:00
|
|
|
attachments Attachment[]
|
|
|
|
|
relatedNotifications Notification[]
|
2024-03-04 02:27:08 +01:00
|
|
|
flags Flag[]
|
2024-03-04 05:33:25 +01:00
|
|
|
modNotes ModNote[]
|
|
|
|
|
modTags ModTag[]
|
2024-03-04 02:27:08 +01:00
|
|
|
}
|
|
|
|
|
|
2024-03-04 05:33:25 +01:00
|
|
|
model ModNote {
|
|
|
|
|
id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid
|
|
|
|
|
notedStatus Status? @relation(fields: [notedStatusId], references: [id], onDelete: Cascade)
|
|
|
|
|
notedStatusId String? @db.Uuid
|
|
|
|
|
notedUser User? @relation("ModNoteToUser", fields: [notedUserId], references: [id], onDelete: Cascade)
|
|
|
|
|
notedUserId String? @db.Uuid
|
|
|
|
|
mod User @relation("ModNoteToMod", fields: [modId], references: [id], onDelete: Cascade)
|
|
|
|
|
modId String @db.Uuid
|
|
|
|
|
note String
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model ModTag {
|
|
|
|
|
id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid
|
|
|
|
|
taggedStatus Status? @relation(fields: [taggedStatusId], references: [id], onDelete: Cascade)
|
|
|
|
|
taggedStatusId String? @db.Uuid
|
|
|
|
|
taggedUser User? @relation("ModNoteToTaggedUser", fields: [taggedUserId], references: [id], onDelete: Cascade)
|
|
|
|
|
taggedUserId String? @db.Uuid
|
|
|
|
|
mod User @relation("ModTagToMod", fields: [modId], references: [id], onDelete: Cascade)
|
|
|
|
|
modId String @db.Uuid
|
|
|
|
|
tag String
|
|
|
|
|
createdAt DateTime @default(now())
|
2024-03-04 02:27:08 +01:00
|
|
|
}
|
|
|
|
|
|
2024-03-04 05:33:25 +01:00
|
|
|
// Used to tag notes and accounts with automatic moderation infractions
|
2024-03-04 02:27:08 +01:00
|
|
|
model Flag {
|
2024-03-04 05:33:25 +01:00
|
|
|
id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid
|
|
|
|
|
flaggedStatus Status? @relation(fields: [flaggeStatusId], references: [id], onDelete: Cascade)
|
|
|
|
|
flaggeStatusId String? @db.Uuid
|
|
|
|
|
flaggedUser User? @relation(fields: [flaggedUserId], references: [id], onDelete: Cascade)
|
|
|
|
|
flaggedUserId String? @db.Uuid
|
|
|
|
|
flagType String @default("other")
|
|
|
|
|
createdAt DateTime @default(now())
|
2023-11-11 03:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Token {
|
|
|
|
|
id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid
|
|
|
|
|
token_type String
|
|
|
|
|
scope String
|
|
|
|
|
access_token String
|
|
|
|
|
code String
|
|
|
|
|
created_at DateTime @default(now())
|
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
|
userId String? @db.Uuid
|
|
|
|
|
application Application? @relation(fields: [applicationId], references: [id], onDelete: Cascade)
|
|
|
|
|
applicationId String? @db.Uuid
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-06 23:10:22 +01:00
|
|
|
model OpenIdLoginFlow {
|
2023-12-07 00:34:56 +01:00
|
|
|
id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid
|
|
|
|
|
codeVerifier String
|
|
|
|
|
issuerId String
|
|
|
|
|
application Application? @relation(fields: [applicationId], references: [id], onDelete: Cascade)
|
|
|
|
|
applicationId String? @db.Uuid
|
2023-12-06 23:10:22 +01:00
|
|
|
}
|
|
|
|
|
|
2023-11-22 01:56:58 +01:00
|
|
|
model Attachment {
|
2023-11-23 05:10:37 +01:00
|
|
|
id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid
|
|
|
|
|
url String
|
|
|
|
|
remote_url String?
|
2023-11-22 01:56:58 +01:00
|
|
|
thumbnail_url String?
|
2023-11-23 05:10:37 +01:00
|
|
|
mime_type String
|
|
|
|
|
description String?
|
|
|
|
|
blurhash String?
|
|
|
|
|
sha256 String?
|
|
|
|
|
fps Int?
|
|
|
|
|
duration Int?
|
|
|
|
|
width Int?
|
|
|
|
|
height Int?
|
|
|
|
|
size Int?
|
|
|
|
|
status Status? @relation(fields: [statusId], references: [id], onDelete: Cascade)
|
|
|
|
|
statusId String? @db.Uuid
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Notification {
|
|
|
|
|
id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid
|
|
|
|
|
type String
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
notified User @relation("NotificationToNotified", fields: [notifiedId], references: [id], onDelete: Cascade)
|
|
|
|
|
notifiedId String @db.Uuid
|
|
|
|
|
account User @relation(fields: [accountId], references: [id], onDelete: Cascade)
|
|
|
|
|
accountId String @db.Uuid
|
|
|
|
|
status Status? @relation(fields: [statusId], references: [id], onDelete: Cascade)
|
|
|
|
|
statusId String? @db.Uuid
|
2023-11-22 01:56:58 +01:00
|
|
|
}
|
|
|
|
|
|
2023-11-11 03:36:06 +01:00
|
|
|
model User {
|
2024-03-04 05:33:25 +01:00
|
|
|
id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid
|
2024-04-09 06:33:59 +02:00
|
|
|
uri String? @unique
|
2024-03-04 05:33:25 +01:00
|
|
|
username String @unique
|
2024-03-04 02:27:08 +01:00
|
|
|
displayName String
|
|
|
|
|
password String? // Nullable
|
2024-03-04 05:33:25 +01:00
|
|
|
email String? @unique // Nullable
|
|
|
|
|
note String @default("")
|
|
|
|
|
isAdmin Boolean @default(false)
|
2024-03-13 09:10:32 +01:00
|
|
|
/// [UserEndpoints]
|
2024-03-04 02:27:08 +01:00
|
|
|
endpoints Json? // Nullable
|
2024-03-13 09:10:32 +01:00
|
|
|
/// [UserSource]
|
2024-03-04 02:27:08 +01:00
|
|
|
source Json
|
|
|
|
|
avatar String
|
|
|
|
|
header String
|
2024-03-04 05:33:25 +01:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
isBot Boolean @default(false)
|
|
|
|
|
isLocked Boolean @default(false)
|
|
|
|
|
isDiscoverable Boolean @default(false)
|
|
|
|
|
sanctions String[] @default([])
|
2024-03-04 02:27:08 +01:00
|
|
|
publicKey String
|
|
|
|
|
privateKey String? // Nullable
|
2024-03-04 05:33:25 +01:00
|
|
|
relationships Relationship[] @relation("OwnerToRelationship") // One to many relation with Relationship
|
|
|
|
|
relationshipSubjects Relationship[] @relation("SubjectToRelationship") // One to many relation with Relationship
|
|
|
|
|
instance Instance? @relation(fields: [instanceId], references: [id], onDelete: Cascade) // Many to one relation with Instance
|
|
|
|
|
instanceId String? @db.Uuid
|
|
|
|
|
pinnedNotes Status[] @relation("UserPinnedNotes") // Many to many relation with Status
|
2024-03-04 02:27:08 +01:00
|
|
|
emojis Emoji[] // Many to many relation with Emoji
|
2024-03-04 05:33:25 +01:00
|
|
|
statuses Status[] @relation("UserStatuses") // One to many relation with Status
|
2024-03-04 02:27:08 +01:00
|
|
|
tokens Token[] // One to many relation with Token
|
2024-03-04 05:33:25 +01:00
|
|
|
likes Like[] @relation("UserLiked") // One to many relation with Like
|
2024-03-04 02:27:08 +01:00
|
|
|
statusesMentioned Status[] // Many to many relation with Status
|
|
|
|
|
notifications Notification[] // One to many relation with Notification
|
2024-03-04 05:33:25 +01:00
|
|
|
notified Notification[] @relation("NotificationToNotified") // One to many relation with Notification
|
2024-03-04 02:27:08 +01:00
|
|
|
linkedOpenIdAccounts OpenIdAccount[] // One to many relation with OpenIdAccount
|
2024-03-04 05:33:25 +01:00
|
|
|
flags Flag[]
|
|
|
|
|
modNotes ModNote[] @relation("ModNoteToUser")
|
|
|
|
|
modTags ModTag[] @relation("ModNoteToTaggedUser")
|
|
|
|
|
disableAutomoderation Boolean @default(false)
|
|
|
|
|
createdModTags ModTag[] @relation("ModTagToMod")
|
|
|
|
|
createdModNotes ModNote[] @relation("ModNoteToMod")
|
2023-12-06 23:10:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model OpenIdAccount {
|
|
|
|
|
id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid
|
|
|
|
|
User User? @relation(fields: [userId], references: [id])
|
|
|
|
|
userId String? @db.Uuid
|
|
|
|
|
serverId String // ID on the authorization server
|
|
|
|
|
issuerId String
|
2023-11-11 03:36:06 +01:00
|
|
|
}
|