Files
Momento/memento-note/prisma/migrations/20260428150000_add_note_history/migration.sql
sepehr ba6f0e9290
Some checks failed
Deploy to Production / Build and Deploy (push) Failing after 43s
fix: add missing NoteHistory migration, fix manifest 403, add API error logging
- Commit untracked 20260428150000_add_note_history migration (creates
  NoteHistory table + noteHistory column) that was causing 500s in prod
- Exclude static files (.json, .svg, .ico, etc.) from auth middleware
  to fix manifest.json 403
- Add console.error to echo API routes for production debug visibility

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 21:37:22 +02:00

44 lines
1.4 KiB
SQL

-- CreateTable
CREATE TABLE "NoteHistory" (
"id" TEXT NOT NULL,
"noteId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"version" INTEGER NOT NULL,
"reason" TEXT,
"title" TEXT,
"content" TEXT NOT NULL,
"color" TEXT NOT NULL,
"isPinned" BOOLEAN NOT NULL,
"isArchived" BOOLEAN NOT NULL,
"type" TEXT NOT NULL,
"checkItems" TEXT,
"labels" TEXT,
"images" TEXT,
"links" TEXT,
"isMarkdown" BOOLEAN NOT NULL,
"size" TEXT NOT NULL,
"notebookId" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "NoteHistory_pkey" PRIMARY KEY ("id")
);
-- AlterTable
ALTER TABLE "UserAISettings"
ADD COLUMN "noteHistory" BOOLEAN NOT NULL DEFAULT false;
-- CreateIndex
CREATE UNIQUE INDEX "NoteHistory_noteId_version_key" ON "NoteHistory"("noteId", "version");
-- CreateIndex
CREATE INDEX "NoteHistory_noteId_createdAt_idx" ON "NoteHistory"("noteId", "createdAt" DESC);
-- CreateIndex
CREATE INDEX "NoteHistory_userId_noteId_createdAt_idx" ON "NoteHistory"("userId", "noteId", "createdAt" DESC);
-- AddForeignKey
ALTER TABLE "NoteHistory" ADD CONSTRAINT "NoteHistory_noteId_fkey" FOREIGN KEY ("noteId") REFERENCES "Note"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "NoteHistory" ADD CONSTRAINT "NoteHistory_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;