mirror of
https://github.com/mblanke/Gov_Travel_App.git
synced 2026-03-01 14:10:22 -05:00
feat: add scripts for database inspection and migration
- Implemented multiple scripts to check and inspect meal plans, scraped data, and accommodations for Munich and Riga. - Added a migration script to convert scraped data into the application's database format. - Introduced new database service methods for querying and updating travel rates. - Enhanced server configuration for serving static files in production. - Updated PostCSS configuration for consistency.
This commit is contained in:
39
scripts/checkScrapedData.js
Normal file
39
scripts/checkScrapedData.js
Normal file
@@ -0,0 +1,39 @@
|
||||
const Database = require("better-sqlite3");
|
||||
const db = new Database("travel_rates.db");
|
||||
|
||||
// Check tables
|
||||
const tables = db
|
||||
.prepare("SELECT name FROM sqlite_master WHERE type='table'")
|
||||
.all();
|
||||
console.log(
|
||||
"Tables in database:",
|
||||
tables.map((t) => t.name)
|
||||
);
|
||||
|
||||
// Check rate entries
|
||||
const rateCount = db
|
||||
.prepare("SELECT COUNT(*) as count FROM rate_entries")
|
||||
.get();
|
||||
console.log("\nRate entries:", rateCount.count);
|
||||
|
||||
// Check accommodations
|
||||
const accommCount = db
|
||||
.prepare("SELECT COUNT(*) as count FROM accommodations")
|
||||
.get();
|
||||
console.log("Accommodations:", accommCount.count);
|
||||
|
||||
// Check Latvia/Riga
|
||||
const latvia = db
|
||||
.prepare(
|
||||
`
|
||||
SELECT city, jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec
|
||||
FROM accommodations
|
||||
WHERE country = 'Latvia'
|
||||
`
|
||||
)
|
||||
.all();
|
||||
|
||||
console.log("\nLatvia accommodations:");
|
||||
console.log(JSON.stringify(latvia, null, 2));
|
||||
|
||||
db.close();
|
||||
Reference in New Issue
Block a user