Files
Momento/memento-note/scripts/debug-notes-size.ts
Sepehr Ramezani aa6a214f37 feat: rename keep-notes to memento-note, migrate to PostgreSQL, fix MCP bugs
- Rename directory keep-notes -> memento-note with all code references
- Prisma: SQLite -> PostgreSQL (both app and MCP server schemas)
- Sync MCP schema with main app (add missing fields, relations, indexes)
- Delete 17 SQLite migrations (clean slate for PostgreSQL)
- Remove SQLite dependencies (@libsql/client, better-sqlite3, etc.)
- Fix MCP server: hardcoded Windows DB paths -> DATABASE_URL env var
- Fix MCP server: .dockerignore excluded index-sse.js (SSE mode broken)
- MCP Dockerfile: node:20 -> node:22
- Docker Compose: add postgres service, remove SQLite volume
- Generate favicon.ico, icon-192.png, icon-512.png, apple-icon.png
- Update layout.tsx icons and manifest.json for PNG icons
- Update all .env files for PostgreSQL
- Rewrite README.md with updated sections
- Remove mcp-server/node_modules and prisma/client-generated from git tracking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-20 20:58:04 +02:00

37 lines
1.4 KiB
TypeScript

import { getAllNotes } from '../app/actions/notes'
import { prisma } from '../lib/prisma'
async function main() {
console.log('🕵️‍♀️ Debugging getAllNotes...')
// 1. Get raw DB data for a sample note
const rawNote = await prisma.note.findFirst({
where: { size: { not: 'small' } }
})
if (rawNote) {
console.log('📊 Raw DB Note (should be large/medium):', {
id: rawNote.id,
size: rawNote.size
})
} else {
console.log('⚠️ No notes with size != small found in DB directly.')
}
// 2. Mock auth/session if needed (actions check session)
// Since we can't easily mock next-auth in this script environment without setup,
// we might need to rely on the direct DB check above or check if getAllNotes extracts userId safely.
// getAllNotes checks `auth()`. In this script context, `auth()` will arguably return null.
// So we can't easily run `getAllNotes` directly if it guards auth.
// Let's modify the plan: We will check the DB directly to confirm PERMANENCE.
// Then we will manually simulate `parseNote` logic.
const notes = await prisma.note.findMany({ take: 5 })
console.log('📋 Checking first 5 notes sizes in DB:')
notes.forEach(n => console.log(`- ${n.id}: ${n.size}`))
}
main().catch(console.error).finally(() => prisma.$disconnect())