63 lines
1.9 KiB
JavaScript
63 lines
1.9 KiB
JavaScript
const { Pool } = require('pg');
|
|
require('dotenv').config();
|
|
|
|
const pool = new Pool({
|
|
host: process.env.DB_HOST || 'localhost',
|
|
port: process.env.DB_PORT || 5432,
|
|
database: process.env.DB_NAME || 'cim_processor',
|
|
user: process.env.DB_USER || 'postgres',
|
|
password: process.env.DB_PASSWORD || 'password',
|
|
});
|
|
|
|
async function checkAgenticTables() {
|
|
const client = await pool.connect();
|
|
|
|
try {
|
|
console.log('🔍 Checking agentic RAG tables...\n');
|
|
|
|
// Check if tables exist
|
|
const tableCheck = await client.query(`
|
|
SELECT table_name
|
|
FROM information_schema.tables
|
|
WHERE table_schema = 'public'
|
|
AND table_name IN ('agentic_rag_sessions', 'agent_executions', 'processing_quality_metrics')
|
|
ORDER BY table_name;
|
|
`);
|
|
|
|
console.log('📋 Agentic RAG Tables Found:', tableCheck.rows.map(r => r.table_name));
|
|
|
|
if (tableCheck.rows.length > 0) {
|
|
// Check strategy constraint
|
|
const constraintCheck = await client.query(`
|
|
SELECT constraint_name, check_clause
|
|
FROM information_schema.check_constraints
|
|
WHERE constraint_name LIKE '%strategy%'
|
|
AND constraint_schema = 'public';
|
|
`);
|
|
|
|
console.log('\n🔒 Strategy Constraints:');
|
|
constraintCheck.rows.forEach(row => {
|
|
console.log(` ${row.constraint_name}: ${row.check_clause}`);
|
|
});
|
|
|
|
// Check existing sessions
|
|
const sessionCheck = await client.query('SELECT id, strategy, status FROM agentic_rag_sessions LIMIT 5;');
|
|
console.log('\n📊 Existing Sessions:');
|
|
if (sessionCheck.rows.length === 0) {
|
|
console.log(' No sessions found');
|
|
} else {
|
|
sessionCheck.rows.forEach(row => {
|
|
console.log(` ${row.id}: ${row.strategy} (${row.status})`);
|
|
});
|
|
}
|
|
}
|
|
|
|
} catch (error) {
|
|
console.error('❌ Error checking tables:', error.message);
|
|
} finally {
|
|
client.release();
|
|
process.exit(0);
|
|
}
|
|
}
|
|
|
|
checkAgenticTables(); |