File size: 1,079 Bytes
6e6c867
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import sql from './db';

async function verify() {
    console.log('--- Verifying DB Content ---');
    try {
        const countResult = await sql`SELECT COUNT(*) FROM routes`;
        const count = countResult[0].count;
        console.log(`Total routes in DB: ${count}`);

        if (count > 0) {
            const sample = await sql`SELECT id, name, path FROM routes LIMIT 5`;
            for (const row of sample) {
                console.log(`Route ID: ${row.id}, Name: ${row.name}`);
                console.log(`Path type: ${typeof row.path}`);
                if (row.path && row.path.coordinates) {
                    const firstPoint = row.path.coordinates[0];
                    console.log(`First point: ${JSON.stringify(firstPoint)}`);
                } else {
                    console.log('Path or coordinates missing/invalid structure:', JSON.stringify(row.path).substring(0, 100));
                }
            }
        }
    } catch (err) {
        console.error('Error verifying DB:', err);
    } finally {
        await sql.end();
    }
}

verify();