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>
This commit is contained in:
76
memento-note/scripts/check-labels.js
Normal file
76
memento-note/scripts/check-labels.js
Normal file
@@ -0,0 +1,76 @@
|
||||
// Import directly from the generated client
|
||||
const { PrismaClient } = require('./node_modules/@prisma/client')
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
async function checkLabels() {
|
||||
try {
|
||||
console.log('\n=== TOUS LES LABELS DANS LA TABLE Label ===')
|
||||
const allLabels = await prisma.label.findMany({
|
||||
select: { id: true, name: true, userId: true }
|
||||
})
|
||||
console.log(`Total: ${allLabels.length} labels`)
|
||||
allLabels.forEach(l => {
|
||||
console.log(` - ${l.name} (userId: ${l.userId}, id: ${l.id})`)
|
||||
})
|
||||
|
||||
console.log('\n=== TOUS LES LABELS DANS LES NOTES (Note.labels) ===')
|
||||
const allNotes = await prisma.note.findMany({
|
||||
select: { id: true, labels: true, userId: true }
|
||||
})
|
||||
|
||||
const labelsInNotes = new Set()
|
||||
allNotes.forEach(note => {
|
||||
if (note.labels) {
|
||||
try {
|
||||
const parsed = JSON.parse(note.labels)
|
||||
if (Array.isArray(parsed)) {
|
||||
parsed.forEach(l => labelsInNotes.add(l))
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
})
|
||||
|
||||
console.log(`Total unique: ${labelsInNotes.size} labels`)
|
||||
labelsInNotes.forEach(l => console.log(` - ${l}`))
|
||||
|
||||
console.log('\n=== LABELS ORPHELINS (dans Label table MAIS PAS dans les notes) ===')
|
||||
const orphanLabels = []
|
||||
allLabels.forEach(label => {
|
||||
let found = false
|
||||
labelsInNotes.forEach(noteLabel => {
|
||||
if (noteLabel.toLowerCase() === label.name.toLowerCase()) {
|
||||
found = true
|
||||
}
|
||||
})
|
||||
if (!found) {
|
||||
orphanLabels.push(label)
|
||||
}
|
||||
})
|
||||
|
||||
console.log(`Total orphans: ${orphanLabels.length}`)
|
||||
orphanLabels.forEach(l => {
|
||||
console.log(` - ${l.name} (userId: ${l.userId})`)
|
||||
})
|
||||
|
||||
console.log('\n=== LABELS MANQUANTS (dans notes MAIS PAS dans Label table) ===')
|
||||
const missingLabels = []
|
||||
const existingLabelNames = new Set()
|
||||
allLabels.forEach(l => existingLabelNames.add(l.name.toLowerCase()))
|
||||
|
||||
labelsInNotes.forEach(noteLabel => {
|
||||
if (!existingLabelNames.has(noteLabel.toLowerCase())) {
|
||||
missingLabels.push(noteLabel)
|
||||
}
|
||||
})
|
||||
|
||||
console.log(`Total missing: ${missingLabels.length}`)
|
||||
missingLabels.forEach(l => console.log(` - ${l}`))
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error:', error)
|
||||
} finally {
|
||||
await prisma.$disconnect()
|
||||
}
|
||||
}
|
||||
|
||||
checkLabels()
|
||||
Reference in New Issue
Block a user