Spaces:
Build error
Build error
File size: 627 Bytes
2c10495 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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);
}
|