mirror of
https://github.com/better-auth/better-hub
synced 2026-08-09 12:26:04 +00:00
## Warning! This PR requires migration. ``` cd apps/web pnpx prisma generate pnpx prisma db push ``` --- Allows you to redirect to the user profile: <img width="2044" height="1140" alt="CleanShot 2026-02-25 at 23 06 01@2x" src="https://github.com/user-attachments/assets/71acc15f-622d-4869-bd82-d5b82b70068f" /> Also fixes inconsistency with the UI counter for closed prompts <img width="2588" height="1166" alt="Attached_image" src="https://github.com/user-attachments/assets/ecaf478b-da72-4ce5-b22b-a896400c504e" /> Also adds the author of a prompt to the UI: <img width="2618" height="1286" alt="CleanShot 2026-02-25 at 23 25 59@2x" src="https://github.com/user-attachments/assets/2cdc3e39-abe8-4377-9622-76c065991144" />
274 lines
5.8 KiB
Plaintext
274 lines
5.8 KiB
Plaintext
|
|
generator client {
|
|
provider = "prisma-client"
|
|
output = "../src/generated/prisma"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
}
|
|
|
|
model User {
|
|
id String @id
|
|
name String
|
|
email String
|
|
githubPat String?
|
|
onboardingDone Boolean @default(false)
|
|
emailVerified Boolean
|
|
image String?
|
|
createdAt DateTime
|
|
updatedAt DateTime
|
|
|
|
sessions Session[]
|
|
accounts Account[]
|
|
|
|
aiMessageCount Int @default(0)
|
|
lastActiveAt DateTime?
|
|
role String?
|
|
banned Boolean? @default(false)
|
|
banReason String?
|
|
banExpires DateTime?
|
|
|
|
@@map("user")
|
|
@@index([githubPat, email])
|
|
}
|
|
|
|
model Session {
|
|
id String @id
|
|
expiresAt DateTime
|
|
token String @unique
|
|
createdAt DateTime
|
|
updatedAt DateTime
|
|
ipAddress String?
|
|
userAgent String?
|
|
userId String
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
impersonatedBy String?
|
|
|
|
@@map("session")
|
|
@@index([userId, expiresAt])
|
|
}
|
|
|
|
model Account {
|
|
id String @id
|
|
accountId String
|
|
providerId String
|
|
userId String
|
|
accessToken String?
|
|
refreshToken String?
|
|
idToken String?
|
|
accessTokenExpiresAt DateTime?
|
|
refreshTokenExpiresAt DateTime?
|
|
scope String?
|
|
password String?
|
|
createdAt DateTime
|
|
updatedAt DateTime
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@map("account")
|
|
@@index([userId, providerId])
|
|
}
|
|
|
|
model Verification {
|
|
id String @id
|
|
identifier String
|
|
value String
|
|
expiresAt DateTime
|
|
createdAt DateTime?
|
|
updatedAt DateTime?
|
|
|
|
@@map("verification")
|
|
@@index([identifier, expiresAt])
|
|
}
|
|
|
|
model GithubCacheEntry {
|
|
userId String
|
|
cacheKey String
|
|
cacheType String
|
|
dataJson String
|
|
syncedAt String
|
|
etag String?
|
|
|
|
@@id([userId, cacheKey])
|
|
@@index([userId, cacheType])
|
|
@@map("github_cache_entries")
|
|
}
|
|
|
|
model GithubSyncJob {
|
|
id Int @id @default(autoincrement())
|
|
userId String
|
|
dedupeKey String
|
|
jobType String
|
|
payloadJson String
|
|
status String @default("pending")
|
|
attempts Int @default(0)
|
|
nextAttemptAt String
|
|
startedAt String?
|
|
lastError String?
|
|
createdAt String
|
|
updatedAt String
|
|
|
|
@@unique([userId, dedupeKey], map: "idx_github_sync_jobs_dedupe_active")
|
|
@@index([userId, status, nextAttemptAt, id])
|
|
@@map("github_sync_jobs")
|
|
}
|
|
|
|
model ChatConversation {
|
|
id String @id
|
|
userId String
|
|
chatType String
|
|
contextKey String
|
|
title String?
|
|
activeStreamId String?
|
|
createdAt String
|
|
updatedAt String
|
|
|
|
messages ChatMessage[]
|
|
|
|
@@unique([userId, contextKey])
|
|
@@index([userId, chatType])
|
|
@@map("chat_conversations")
|
|
}
|
|
|
|
model ChatMessage {
|
|
id String @id
|
|
conversationId String
|
|
role String
|
|
content String
|
|
partsJson String?
|
|
createdAt String
|
|
|
|
conversation ChatConversation @relation(fields: [conversationId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([conversationId, createdAt])
|
|
@@map("chat_messages")
|
|
}
|
|
|
|
model GhostTab {
|
|
userId String
|
|
tabId String
|
|
label String
|
|
position Int
|
|
|
|
@@id([userId, tabId])
|
|
@@map("ghost_tabs")
|
|
}
|
|
|
|
model GhostTabState {
|
|
userId String @id
|
|
activeTabId String
|
|
counter Int @default(1)
|
|
|
|
@@map("ghost_tab_state")
|
|
}
|
|
|
|
model UserSettings {
|
|
userId String @id
|
|
displayName String?
|
|
theme String @default("system")
|
|
colorTheme String @default("midnight")
|
|
ghostModel String @default("auto")
|
|
useOwnApiKey Boolean @default(false)
|
|
openrouterApiKey String?
|
|
githubPat String?
|
|
codeThemeLight String @default("vitesse-light")
|
|
codeThemeDark String @default("vitesse-black")
|
|
codeFont String @default("default")
|
|
codeFontSize Int @default(13)
|
|
onboardingDone Boolean @default(false)
|
|
updatedAt String
|
|
|
|
@@map("user_settings")
|
|
}
|
|
|
|
model CustomCodeTheme {
|
|
id String @id
|
|
userId String
|
|
name String
|
|
mode String @default("dark")
|
|
themeJson String
|
|
bgColor String
|
|
fgColor String
|
|
accentColor String
|
|
createdAt String
|
|
|
|
@@map("custom_code_themes")
|
|
}
|
|
|
|
|
|
model SearchEmbedding {
|
|
id String @id
|
|
userId String
|
|
contentType String
|
|
contentKey String
|
|
owner String
|
|
repo String
|
|
itemNumber Int
|
|
contentHash String
|
|
embeddingJson String
|
|
title String?
|
|
snippet String
|
|
metadataJson String?
|
|
createdAt String
|
|
updatedAt String
|
|
|
|
@@index([userId, owner, repo])
|
|
@@index([userId, contentType, contentKey])
|
|
@@map("search_embeddings")
|
|
}
|
|
|
|
model PinnedItem {
|
|
id String @id
|
|
userId String
|
|
owner String
|
|
repo String
|
|
url String
|
|
title String
|
|
itemType String
|
|
pinnedAt String
|
|
|
|
@@unique([userId, owner, repo, url])
|
|
@@index([userId, owner, repo])
|
|
@@map("pinned_items")
|
|
}
|
|
|
|
model PromptRequest {
|
|
id String @id
|
|
userId String
|
|
userLogin String?
|
|
userName String?
|
|
userAvatarUrl String?
|
|
owner String
|
|
repo String
|
|
title String
|
|
body String
|
|
status String @default("open")
|
|
acceptedById String?
|
|
acceptedByName String?
|
|
createdAt String
|
|
updatedAt String
|
|
|
|
@@index([owner, repo, status])
|
|
@@index([userId])
|
|
@@map("prompt_requests")
|
|
}
|
|
|
|
model PromptRequestComment {
|
|
id String @id
|
|
promptRequestId String
|
|
userId String
|
|
userLogin String?
|
|
userName String
|
|
userAvatarUrl String
|
|
body String
|
|
createdAt String
|
|
updatedAt String
|
|
|
|
@@index([promptRequestId, createdAt])
|
|
@@index([userId])
|
|
@@map("prompt_request_comments")
|
|
}
|