feat(db): extraction des embeddings + mode WAL + config DB provider-agnostic

- Ajout de la table de relation 1-1 NoteEmbedding pour alléger Model Note
- Refactor complet des actions IA sémantique et Memory Echo pour utiliser la jointure
- Migration propre des 85 embeddings locaux existants
- Ajout PRAGMA journal_mode=WAL pour la concurrence au sein de lib/prisma
- Ajout npm run db:switch pour configuration auto SQLite / PostgreSQL
- Fix du compilateur Turbopack et Next-PWA
This commit is contained in:
Sepehr Ramezani
2026-04-17 22:05:19 +02:00
parent a57c277168
commit 3ef5915062
10 changed files with 180 additions and 36 deletions

View File

@@ -17,6 +17,12 @@ declare const globalThis: {
const prisma = globalThis.prismaGlobal ?? prismaClientSingleton()
// Enable WAL mode for SQLite to improve concurrent read/write performance
if (process.env.DATABASE_URL?.includes('sqlite') || prismaClientSingleton.toString().includes('sqlite')) {
// Execute via an un-awaited promise or fire-and-forget, PRAGMA is session-based but setting it globally sets DB state
prisma.$executeRawUnsafe('PRAGMA journal_mode = WAL;').catch(console.error)
}
export { prisma }
export default prisma