feat(notes): liens internes, onglet Réseau, living blocks et consentement IA
Rend les liens entre notes visibles et persistants (sync NoteLink au save, auto-save, graphe réseau rafraîchi), ajoute living blocks, Memory Echo, recherche globale, consentement IA explicite et consolide les prototypes design en architectural-grid. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "LiveBlockRef" (
|
||||
"id" TEXT NOT NULL,
|
||||
"sourceNoteId" TEXT NOT NULL,
|
||||
"blockId" TEXT NOT NULL,
|
||||
"targetNoteId" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "LiveBlockRef_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "LiveBlockRef_sourceNoteId_blockId_idx" ON "LiveBlockRef"("sourceNoteId", "blockId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "LiveBlockRef_targetNoteId_idx" ON "LiveBlockRef"("targetNoteId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "LiveBlockRef" ADD CONSTRAINT "LiveBlockRef_sourceNoteId_fkey" FOREIGN KEY ("sourceNoteId") REFERENCES "Note"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "LiveBlockRef" ADD CONSTRAINT "LiveBlockRef_targetNoteId_fkey" FOREIGN KEY ("targetNoteId") REFERENCES "Note"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,26 @@
|
||||
-- CreateTable (additive — table may already exist from db push)
|
||||
CREATE TABLE IF NOT EXISTS "NoteLink" (
|
||||
"id" TEXT NOT NULL,
|
||||
"sourceNoteId" TEXT NOT NULL,
|
||||
"targetNoteId" TEXT NOT NULL,
|
||||
"contextSnippet" TEXT,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "NoteLink_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS "NoteLink_sourceNoteId_targetNoteId_key" ON "NoteLink"("sourceNoteId", "targetNoteId");
|
||||
CREATE INDEX IF NOT EXISTS "NoteLink_sourceNoteId_idx" ON "NoteLink"("sourceNoteId");
|
||||
CREATE INDEX IF NOT EXISTS "NoteLink_targetNoteId_idx" ON "NoteLink"("targetNoteId");
|
||||
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "NoteLink" ADD CONSTRAINT "NoteLink_sourceNoteId_fkey" FOREIGN KEY ("sourceNoteId") REFERENCES "Note"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "NoteLink" ADD CONSTRAINT "NoteLink_targetNoteId_fkey" FOREIGN KEY ("targetNoteId") REFERENCES "Note"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
@@ -191,6 +191,8 @@ model Note {
|
||||
incomingLinks NoteLink[] @relation("TargetLinks")
|
||||
clusterMemberships ClusterMember[]
|
||||
bridgeNote BridgeNote?
|
||||
sourceLiveBlocks LiveBlockRef[] @relation("SourceLiveBlocks")
|
||||
targetLiveBlocks LiveBlockRef[] @relation("TargetLiveBlocks")
|
||||
|
||||
@@index([isPinned])
|
||||
@@index([isArchived])
|
||||
@@ -201,6 +203,19 @@ model Note {
|
||||
@@index([userId, notebookId])
|
||||
}
|
||||
|
||||
model LiveBlockRef {
|
||||
id String @id @default(cuid())
|
||||
sourceNoteId String
|
||||
blockId String
|
||||
targetNoteId String
|
||||
createdAt DateTime @default(now())
|
||||
sourceNote Note @relation("SourceLiveBlocks", fields: [sourceNoteId], references: [id], onDelete: Cascade)
|
||||
targetNote Note @relation("TargetLiveBlocks", fields: [targetNoteId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([sourceNoteId, blockId])
|
||||
@@index([targetNoteId])
|
||||
}
|
||||
|
||||
model NoteHistory {
|
||||
id String @id @default(cuid())
|
||||
noteId String
|
||||
|
||||
Reference in New Issue
Block a user