wallets-api / server /inspect_db.js
z1amez's picture
v.1
2dddd1f
raw
history blame contribute delete
788 Bytes
const sqlite3 = require('sqlite3');
const path = require('path');
const dbPath = path.resolve(__dirname, 'database.sqlite');
const db = new sqlite3.Database(dbPath);
console.log('Reading database:', dbPath);
db.serialize(() => {
db.serialize(() => {
db.all('SELECT * FROM wallets', (err, rows) => {
if (err) {
console.error('Error reading wallets:', err);
return;
}
console.log('--- WALLETS ---');
rows.forEach(r => {
console.log(`|${r.name}| (Length: ${r.name.length})`);
});
console.log(JSON.stringify(rows, null, 2));
console.log('---------------');
});
db.all('SELECT count(*) as count FROM transactions', (err, rows) => {
if (err) return;
console.log('Transactions count:', rows[0].count);
});
});
});
db.close();