perf: memo GridCard, fuse save fns, fix slash tab active color
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "UserAPIKey" ADD COLUMN "baseUrl" TEXT;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "UserAISettings" ADD COLUMN "svgComplexity" TEXT NOT NULL DEFAULT 'simple';
|
||||
@@ -0,0 +1,32 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "NoteEmbeddingChunk" (
|
||||
"id" TEXT NOT NULL,
|
||||
"noteId" TEXT NOT NULL,
|
||||
"fragmentId" TEXT NOT NULL,
|
||||
"chunkIndex" INTEGER NOT NULL,
|
||||
"content" TEXT NOT NULL,
|
||||
"charCount" INTEGER NOT NULL,
|
||||
"embedding" vector(1536),
|
||||
"embeddingModel" TEXT DEFAULT 'text-embedding-3-small',
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "NoteEmbeddingChunk_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "NoteEmbeddingChunk_noteId_fragmentId_key" ON "NoteEmbeddingChunk"("noteId", "fragmentId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "NoteEmbeddingChunk_noteId_idx" ON "NoteEmbeddingChunk"("noteId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "NoteEmbeddingChunk_fragmentId_idx" ON "NoteEmbeddingChunk"("fragmentId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "NoteEmbeddingChunk" ADD CONSTRAINT "NoteEmbeddingChunk_noteId_fkey" FOREIGN KEY ("noteId") REFERENCES "Note"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- CreateIndex: HNSW index for fast cosine similarity search on chunk embeddings
|
||||
CREATE INDEX "NoteEmbeddingChunk_embedding_hnsw_idx"
|
||||
ON "NoteEmbeddingChunk" USING hnsw ("embedding" vector_cosine_ops)
|
||||
WITH (m = 16, ef_construction = 64);
|
||||
@@ -57,6 +57,7 @@ model User {
|
||||
bridgeNotes BridgeNote[]
|
||||
bridgeSuggestions BridgeSuggestion[]
|
||||
flashcardDecks FlashcardDeck[]
|
||||
errorLogs ErrorLog[]
|
||||
}
|
||||
|
||||
model Account {
|
||||
@@ -204,6 +205,7 @@ model Note {
|
||||
targetLiveBlocks LiveBlockRef[] @relation("TargetLiveBlocks")
|
||||
flashcards Flashcard[]
|
||||
properties NoteProperty[]
|
||||
embeddingChunks NoteEmbeddingChunk[]
|
||||
|
||||
@@index([isPinned])
|
||||
@@index([isArchived])
|
||||
@@ -342,6 +344,7 @@ model UserAISettings {
|
||||
noteHistoryMode String @default("manual")
|
||||
autoSave Boolean @default(true)
|
||||
aiProcessingConsent Boolean @default(false)
|
||||
svgComplexity String @default("simple")
|
||||
integrationTokens Json? // Stores third-party integration tokens (Readwise, Calendar, etc.)
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@ -371,6 +374,24 @@ model NoteEmbedding {
|
||||
@@index([noteId])
|
||||
}
|
||||
|
||||
model NoteEmbeddingChunk {
|
||||
id String @id @default(cuid())
|
||||
noteId String
|
||||
fragmentId String
|
||||
chunkIndex Int
|
||||
content String
|
||||
charCount Int
|
||||
embedding Unsupported("vector(1536)")?
|
||||
embeddingModel String? @default("text-embedding-3-small")
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
note Note @relation(fields: [noteId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([noteId, fragmentId])
|
||||
@@index([noteId])
|
||||
@@index([fragmentId])
|
||||
}
|
||||
|
||||
model NoteLink {
|
||||
id String @id @default(cuid())
|
||||
sourceNoteId String
|
||||
@@ -711,6 +732,7 @@ model UserAPIKey {
|
||||
encryptedKey String
|
||||
keyHash String
|
||||
model String?
|
||||
baseUrl String? @db.Text
|
||||
isActive Boolean @default(true)
|
||||
lastUsedAt DateTime?
|
||||
lastUsedFor String?
|
||||
@@ -962,3 +984,23 @@ model AuditLog {
|
||||
@@index([action])
|
||||
@@index([createdAt])
|
||||
}
|
||||
|
||||
model ErrorLog {
|
||||
id String @id @default(cuid())
|
||||
userId String?
|
||||
message String
|
||||
stack String? @db.Text
|
||||
url String?
|
||||
userAgent String? @db.Text
|
||||
component String? // Component name where error occurred
|
||||
severity String @default("error") // error, warning, info
|
||||
resolved Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@index([userId])
|
||||
@@index([severity])
|
||||
@@index([createdAt])
|
||||
@@index([resolved])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user