Files
dwroller/scripts/check-shop-stats.js
Alex 9d53410aab Add migration script to import JSON data into SQLite database
- Created a new script `migrate-to-sqlite.js` to migrate data from JSON files into a SQLite database.
- Implemented functions to read JSON files safely and handle errors.
- Established database schema with tables for armour, weapons, bestiary, and rules.
- Added logic to insert data from JSON files into the corresponding database tables.
- Included backup functionality for the existing database before migration.
- Logged import totals and sample data from each table for verification.
- Added a new script `check-shop-stats.js` to fetch and log item statistics from the database.
2025-08-17 19:14:29 +02:00

12 lines
386 B
JavaScript

const shop = require('../database/shop-helpers');
shop.getAllItems().then(items => {
console.log('items:', items.length);
const s = items.find(i => i.id === 786) || items[0];
console.log('sample id', s.id, 'stats type', typeof s.stats);
console.log('stats sample', JSON.stringify(s.stats, null, 2).slice(0, 400));
}).catch(err => {
console.error(err);
process.exit(1);
});