fix: sync MCP schema exactly with memento-note (full copy)
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 16s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 16s
Copy all models used by MCP tools with every field, relation, and index from memento-note/prisma/schema.prisma. No more guessing which relations are needed — it's an exact subset. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
// ============================================================================
|
||||||
|
// MCP Server Schema — exact copy from memento-note (source of truth)
|
||||||
|
// Only includes models used by MCP tools.
|
||||||
|
// Do NOT modify independently — always sync with memento-note/prisma/schema.prisma
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
generator client {
|
generator client {
|
||||||
provider = "prisma-client-js"
|
provider = "prisma-client-js"
|
||||||
output = "../node_modules/.prisma/client"
|
output = "../node_modules/.prisma/client"
|
||||||
@@ -9,79 +15,7 @@ datasource db {
|
|||||||
url = env("DATABASE_URL")
|
url = env("DATABASE_URL")
|
||||||
}
|
}
|
||||||
|
|
||||||
model Note {
|
// ── Core models (used by MCP tools) ─────────────────────────────────────────
|
||||||
id String @id @default(cuid())
|
|
||||||
title String?
|
|
||||||
content String
|
|
||||||
color String @default("default")
|
|
||||||
isPinned Boolean @default(false)
|
|
||||||
isArchived Boolean @default(false)
|
|
||||||
trashedAt DateTime?
|
|
||||||
type String @default("text")
|
|
||||||
dismissedFromRecent Boolean @default(false)
|
|
||||||
checkItems String?
|
|
||||||
labels String?
|
|
||||||
images String?
|
|
||||||
links String?
|
|
||||||
reminder DateTime?
|
|
||||||
isReminderDone Boolean @default(false)
|
|
||||||
reminderRecurrence String?
|
|
||||||
reminderLocation String?
|
|
||||||
isMarkdown Boolean @default(false)
|
|
||||||
size String @default("small")
|
|
||||||
sharedWith String?
|
|
||||||
userId String?
|
|
||||||
order Int @default(0)
|
|
||||||
notebookId String?
|
|
||||||
createdAt DateTime @default(now())
|
|
||||||
updatedAt DateTime @updatedAt
|
|
||||||
contentUpdatedAt DateTime @default(now())
|
|
||||||
autoGenerated Boolean?
|
|
||||||
aiProvider String?
|
|
||||||
aiConfidence Int?
|
|
||||||
language String?
|
|
||||||
languageConfidence Float?
|
|
||||||
lastAiAnalysis DateTime?
|
|
||||||
noteEmbedding NoteEmbedding?
|
|
||||||
}
|
|
||||||
|
|
||||||
model NoteEmbedding {
|
|
||||||
id String @id @default(cuid())
|
|
||||||
noteId String @unique
|
|
||||||
embedding String
|
|
||||||
createdAt DateTime @default(now())
|
|
||||||
note Note @relation(fields: [noteId], references: [id], onDelete: Cascade)
|
|
||||||
|
|
||||||
@@index([noteId])
|
|
||||||
}
|
|
||||||
|
|
||||||
model Notebook {
|
|
||||||
id String @id @default(cuid())
|
|
||||||
name String
|
|
||||||
icon String?
|
|
||||||
color String?
|
|
||||||
order Int
|
|
||||||
userId String
|
|
||||||
createdAt DateTime @default(now())
|
|
||||||
updatedAt DateTime @updatedAt
|
|
||||||
notes Note[]
|
|
||||||
labels Label[]
|
|
||||||
}
|
|
||||||
|
|
||||||
model Label {
|
|
||||||
id String @id @default(cuid())
|
|
||||||
name String
|
|
||||||
color String @default("gray")
|
|
||||||
notebookId String?
|
|
||||||
userId String?
|
|
||||||
createdAt DateTime @default(now())
|
|
||||||
updatedAt DateTime @updatedAt
|
|
||||||
notebook Notebook? @relation(fields: [notebookId], references: [id], onDelete: Cascade)
|
|
||||||
|
|
||||||
@@unique([notebookId, name])
|
|
||||||
@@index([notebookId])
|
|
||||||
@@index([userId])
|
|
||||||
}
|
|
||||||
|
|
||||||
model User {
|
model User {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
@@ -97,8 +31,136 @@ model User {
|
|||||||
resetTokenExpiry DateTime?
|
resetTokenExpiry DateTime?
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
accounts Account[]
|
||||||
|
aiFeedback AiFeedback[]
|
||||||
|
labels Label[]
|
||||||
|
memoryEchoInsights MemoryEchoInsight[]
|
||||||
|
notes Note[]
|
||||||
|
sentShares NoteShare[] @relation("SentShares")
|
||||||
|
receivedShares NoteShare[] @relation("ReceivedShares")
|
||||||
|
notebooks Notebook[]
|
||||||
|
sessions Session[]
|
||||||
|
aiSettings UserAISettings?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model Notebook {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
name String
|
||||||
|
icon String?
|
||||||
|
color String?
|
||||||
|
order Int
|
||||||
|
userId String
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
labels Label[]
|
||||||
|
notes Note[]
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
@@index([userId, order])
|
||||||
|
@@index([userId])
|
||||||
|
}
|
||||||
|
|
||||||
|
model Label {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
name String
|
||||||
|
color String @default("gray")
|
||||||
|
notebookId String?
|
||||||
|
userId String?
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
notebook Notebook? @relation(fields: [notebookId], references: [id], onDelete: Cascade)
|
||||||
|
notes Note[] @relation("LabelToNote")
|
||||||
|
|
||||||
|
@@unique([notebookId, name])
|
||||||
|
@@index([notebookId])
|
||||||
|
@@index([userId])
|
||||||
|
}
|
||||||
|
|
||||||
|
model Note {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
title String?
|
||||||
|
content String
|
||||||
|
color String @default("default")
|
||||||
|
isPinned Boolean @default(false)
|
||||||
|
isArchived Boolean @default(false)
|
||||||
|
trashedAt DateTime?
|
||||||
|
type String @default("text")
|
||||||
|
dismissedFromRecent Boolean @default(false)
|
||||||
|
checkItems String?
|
||||||
|
labels String?
|
||||||
|
images String?
|
||||||
|
links String?
|
||||||
|
reminder DateTime?
|
||||||
|
isReminderDone Boolean @default(false)
|
||||||
|
reminderRecurrence String?
|
||||||
|
reminderLocation String?
|
||||||
|
isMarkdown Boolean @default(false)
|
||||||
|
size String @default("small")
|
||||||
|
sharedWith String?
|
||||||
|
userId String?
|
||||||
|
order Int @default(0)
|
||||||
|
notebookId String?
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
contentUpdatedAt DateTime @default(now())
|
||||||
|
autoGenerated Boolean?
|
||||||
|
aiProvider String?
|
||||||
|
aiConfidence Int?
|
||||||
|
language String?
|
||||||
|
languageConfidence Float?
|
||||||
|
lastAiAnalysis DateTime?
|
||||||
|
aiFeedback AiFeedback[]
|
||||||
|
memoryEchoAsNote2 MemoryEchoInsight[] @relation("EchoNote2")
|
||||||
|
memoryEchoAsNote1 MemoryEchoInsight[] @relation("EchoNote1")
|
||||||
|
notebook Notebook? @relation(fields: [notebookId], references: [id])
|
||||||
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
shares NoteShare[]
|
||||||
|
labelRelations Label[] @relation("LabelToNote")
|
||||||
|
noteEmbedding NoteEmbedding?
|
||||||
|
|
||||||
|
@@index([isPinned])
|
||||||
|
@@index([isArchived])
|
||||||
|
@@index([trashedAt])
|
||||||
|
@@index([order])
|
||||||
|
@@index([reminder])
|
||||||
|
@@index([userId])
|
||||||
|
@@index([userId, notebookId])
|
||||||
|
}
|
||||||
|
|
||||||
|
model NoteEmbedding {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
noteId String @unique
|
||||||
|
embedding String
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
note Note @relation(fields: [noteId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
@@index([noteId])
|
||||||
|
}
|
||||||
|
|
||||||
|
model NoteShare {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
noteId String
|
||||||
|
userId String
|
||||||
|
sharedBy String
|
||||||
|
status String @default("pending")
|
||||||
|
permission String @default("view")
|
||||||
|
notifiedAt DateTime?
|
||||||
|
respondedAt DateTime?
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
sharer User @relation("SentShares", fields: [sharedBy], references: [id], onDelete: Cascade)
|
||||||
|
user User @relation("ReceivedShares", fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
note Note @relation(fields: [noteId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
@@unique([noteId, userId])
|
||||||
|
@@index([userId])
|
||||||
|
@@index([status])
|
||||||
|
@@index([sharedBy])
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Supporting models (used for auth, AI features, config) ──────────────────
|
||||||
|
|
||||||
model Account {
|
model Account {
|
||||||
userId String
|
userId String
|
||||||
type String
|
type String
|
||||||
@@ -113,6 +175,7 @@ model Account {
|
|||||||
session_state String?
|
session_state String?
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
@@id([provider, providerAccountId])
|
@@id([provider, providerAccountId])
|
||||||
}
|
}
|
||||||
@@ -123,6 +186,7 @@ model Session {
|
|||||||
expires DateTime
|
expires DateTime
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
}
|
}
|
||||||
|
|
||||||
model VerificationToken {
|
model VerificationToken {
|
||||||
@@ -133,21 +197,6 @@ model VerificationToken {
|
|||||||
@@id([identifier, token])
|
@@id([identifier, token])
|
||||||
}
|
}
|
||||||
|
|
||||||
model NoteShare {
|
|
||||||
id String @id @default(cuid())
|
|
||||||
noteId String
|
|
||||||
userId String
|
|
||||||
sharedBy String
|
|
||||||
status String @default("pending")
|
|
||||||
permission String @default("view")
|
|
||||||
notifiedAt DateTime?
|
|
||||||
respondedAt DateTime?
|
|
||||||
createdAt DateTime @default(now())
|
|
||||||
updatedAt DateTime @updatedAt
|
|
||||||
|
|
||||||
@@unique([noteId, userId])
|
|
||||||
}
|
|
||||||
|
|
||||||
model SystemConfig {
|
model SystemConfig {
|
||||||
key String @id
|
key String @id
|
||||||
value String
|
value String
|
||||||
@@ -162,7 +211,13 @@ model AiFeedback {
|
|||||||
originalContent String
|
originalContent String
|
||||||
correctedContent String?
|
correctedContent String?
|
||||||
metadata String?
|
metadata String?
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
note Note @relation(fields: [noteId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
@@index([noteId])
|
||||||
|
@@index([userId])
|
||||||
|
@@index([feature])
|
||||||
}
|
}
|
||||||
|
|
||||||
model MemoryEchoInsight {
|
model MemoryEchoInsight {
|
||||||
@@ -176,24 +231,35 @@ model MemoryEchoInsight {
|
|||||||
viewed Boolean @default(false)
|
viewed Boolean @default(false)
|
||||||
feedback String?
|
feedback String?
|
||||||
dismissed Boolean @default(false)
|
dismissed Boolean @default(false)
|
||||||
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
note2 Note @relation("EchoNote2", fields: [note2Id], references: [id], onDelete: Cascade)
|
||||||
|
note1 Note @relation("EchoNote1", fields: [note1Id], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
@@unique([userId, insightDate])
|
@@unique([userId, insightDate])
|
||||||
|
@@index([userId, insightDate])
|
||||||
|
@@index([userId, dismissed])
|
||||||
}
|
}
|
||||||
|
|
||||||
model UserAISettings {
|
model UserAISettings {
|
||||||
userId String @id
|
userId String @id
|
||||||
titleSuggestions Boolean @default(true)
|
titleSuggestions Boolean @default(true)
|
||||||
semanticSearch Boolean @default(true)
|
semanticSearch Boolean @default(true)
|
||||||
paragraphRefactor Boolean @default(true)
|
paragraphRefactor Boolean @default(true)
|
||||||
memoryEcho Boolean @default(true)
|
memoryEcho Boolean @default(true)
|
||||||
memoryEchoFrequency String @default("daily")
|
memoryEchoFrequency String @default("daily")
|
||||||
aiProvider String @default("auto")
|
aiProvider String @default("auto")
|
||||||
preferredLanguage String @default("auto")
|
preferredLanguage String @default("auto")
|
||||||
fontSize String @default("medium")
|
fontSize String @default("medium")
|
||||||
demoMode Boolean @default(false)
|
demoMode Boolean @default(false)
|
||||||
showRecentNotes Boolean @default(true)
|
showRecentNotes Boolean @default(true)
|
||||||
notesViewMode String @default("masonry")
|
notesViewMode String @default("masonry")
|
||||||
emailNotifications Boolean @default(false)
|
emailNotifications Boolean @default(false)
|
||||||
desktopNotifications Boolean @default(false)
|
desktopNotifications Boolean @default(false)
|
||||||
anonymousAnalytics Boolean @default(false)
|
anonymousAnalytics Boolean @default(false)
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
@@index([memoryEcho])
|
||||||
|
@@index([aiProvider])
|
||||||
|
@@index([memoryEchoFrequency])
|
||||||
|
@@index([preferredLanguage])
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user