-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick_db_check.js
More file actions
59 lines (46 loc) Β· 1.85 KB
/
quick_db_check.js
File metadata and controls
59 lines (46 loc) Β· 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Quick database checker using the existing bot infrastructure
require('dotenv').config();
const { execSync } = require('child_process');
console.log('π Quick SpacetimeDB Table Check');
console.log('=================================');
// List of all tables
const tables = [
'AiReplies',
'GameResult',
'GameRooms',
'Leaderboard',
'Messages',
'RoomPlayers',
'RoomTemplate',
'Users'
];
console.log('π Checking table row counts...\n');
// Try to query each table for basic info
tables.forEach(table => {
try {
console.log(`π ${table}:`);
// Try to get count
const countQuery = `SELECT COUNT(*) as count FROM ${table}`;
console.log(` Query: ${countQuery}`);
// Since we don't have direct access, let's show what queries you should run
console.log(` Run: spacetime sql hophacks-chat "${countQuery}"`);
console.log('');
} catch (error) {
console.log(` β Error accessing ${table}: ${error.message}`);
}
});
console.log('π Manual Query Commands:');
console.log('========================');
tables.forEach(table => {
console.log(`\n# Check ${table} table:`);
console.log(`spacetime sql hophacks-chat "SELECT COUNT(*) FROM ${table}"`);
console.log(`spacetime sql hophacks-chat "SELECT * FROM ${table} LIMIT 3"`);
});
console.log('\nπ Complete database summary:');
const summaryQuery = `SELECT ${tables.map(t => `(SELECT COUNT(*) FROM ${t}) as ${t.toLowerCase()}`).join(', ')}`;
console.log(`spacetime sql hophacks-chat "${summaryQuery}"`);
console.log('\nπ‘ If all tables show 0 rows, the React app is not connected to SpacetimeDB properly.');
console.log(' Check if reducers are being called in RoomPage.tsx');
// Check if the bot service is seeing any data
console.log('\nπ€ Bot Service Status:');
console.log('The simple-bot.js is running and shows empty tables, confirming the issue.');