Spaces:
Build error
Build error
| import Database from 'better-sqlite3'; | |
| import path from 'path'; | |
| const dbPath = path.join(process.cwd(), 'rag-kb.db'); | |
| const db = new Database(dbPath); | |
| console.log('Checking sort_order in documents table...'); | |
| try { | |
| const rows = db.prepare('SELECT title, sort_order, namespace FROM documents ORDER BY namespace, sort_order LIMIT 20').all(); | |
| console.log(JSON.stringify(rows, null, 2)); | |
| const count = db.prepare('SELECT COUNT(*) as count FROM documents WHERE sort_order = 0').get() as { count: number }; | |
| console.log(`Documents with sort_order = 0: ${count.count}`); | |
| } catch (e) { | |
| console.error(e); | |
| } | |