Reset local main to gitea/master (new source of truth) and restored local-only files: web scrapers, admin dashboard, ChromaDB integration, debug scripts, and utility libraries that aren't tracked in Gitea. Gitea master adds: discovermass, buscarmisas-network, hk-parishes, bohosluzby, kerknet, gottesdienstzeiten, miserend importers, ClaimRequest model, forward geocoding, heartbeat healthcheck. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
89 lines
2.8 KiB
TypeScript
Executable File
89 lines
2.8 KiB
TypeScript
Executable File
#!/usr/bin/env tsx
|
||
|
||
/**
|
||
* Check production database (Neon) for data
|
||
* Run with: npx tsx scripts/check-production-db.ts
|
||
*/
|
||
|
||
import { Pool } from 'pg';
|
||
import { config } from 'dotenv';
|
||
|
||
// Load environment variables (.env.local overrides .env)
|
||
config({ path: '.env.local' });
|
||
config({ path: '.env' });
|
||
|
||
const connectionString = process.env.DATABASE_URL;
|
||
|
||
if (!connectionString) {
|
||
console.error('❌ DATABASE_URL not found in environment');
|
||
process.exit(1);
|
||
}
|
||
|
||
console.log('🔍 Checking production database...');
|
||
console.log('📍 Connection:', connectionString.includes('neon.tech') ? 'Neon (Production)' : 'localhost');
|
||
|
||
const pool = new Pool({ connectionString });
|
||
|
||
async function checkDatabase() {
|
||
try {
|
||
// Test connection
|
||
console.log('\n1️⃣ Testing database connection...');
|
||
await pool.query('SELECT NOW()');
|
||
console.log('✅ Database connection successful');
|
||
|
||
// Check tables exist
|
||
console.log('\n2️⃣ Checking tables...');
|
||
const tablesResult = await pool.query(`
|
||
SELECT table_name
|
||
FROM information_schema.tables
|
||
WHERE table_schema = 'public'
|
||
ORDER BY table_name
|
||
`);
|
||
console.log(`✅ Found ${tablesResult.rows.length} tables:`, tablesResult.rows.map(r => r.table_name).join(', '));
|
||
|
||
// Check churches
|
||
console.log('\n3️⃣ Checking churches...');
|
||
const churchCount = await pool.query('SELECT COUNT(*) FROM "churches"');
|
||
console.log(`📊 Churches: ${churchCount.rows[0].count}`);
|
||
|
||
if (parseInt(churchCount.rows[0].count) > 0) {
|
||
const sampleChurch = await pool.query('SELECT id, name, city, state, latitude, longitude FROM "churches" LIMIT 1');
|
||
console.log('📍 Sample church:', sampleChurch.rows[0]);
|
||
} else {
|
||
console.log('⚠️ No churches found in database!');
|
||
}
|
||
|
||
// Check mass schedules
|
||
console.log('\n4️⃣ Checking mass schedules...');
|
||
const massCount = await pool.query('SELECT COUNT(*) FROM "mass_schedules"');
|
||
console.log(`📊 Mass schedules: ${massCount.rows[0].count}`);
|
||
|
||
// Check liturgical days
|
||
console.log('\n5️⃣ Checking liturgical days...');
|
||
const liturgicalCount = await pool.query('SELECT COUNT(*) FROM "liturgical_days"');
|
||
console.log(`📊 Liturgical days: ${liturgicalCount.rows[0].count}`);
|
||
|
||
// Check today's liturgical data
|
||
const today = new Date().toISOString().split('T')[0];
|
||
const todayData = await pool.query(
|
||
'SELECT * FROM "liturgical_days" WHERE date = $1',
|
||
[today]
|
||
);
|
||
if (todayData.rows.length > 0) {
|
||
console.log(`✅ Today's liturgical data exists:`, todayData.rows[0].season);
|
||
} else {
|
||
console.log(`⚠️ No liturgical data for today (${today})`);
|
||
}
|
||
|
||
console.log('\n✨ Database check complete!\n');
|
||
|
||
} catch (error) {
|
||
console.error('❌ Error:', error);
|
||
process.exit(1);
|
||
} finally {
|
||
await pool.end();
|
||
}
|
||
}
|
||
|
||
checkDatabase();
|