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:
38
scripts/inspectFreshData.js
Normal file
38
scripts/inspectFreshData.js
Normal file
@@ -0,0 +1,38 @@
|
||||
const Database = require("better-sqlite3");
|
||||
const sourceDb = new Database("data/travel_rates_scraped.sqlite3");
|
||||
|
||||
// Check schema
|
||||
console.log("\n=== ACCOMMODATIONS SCHEMA ===");
|
||||
const accomSchema = sourceDb
|
||||
.prepare(
|
||||
"SELECT sql FROM sqlite_master WHERE type='table' AND name='accommodations'"
|
||||
)
|
||||
.get();
|
||||
console.log(accomSchema.sql);
|
||||
|
||||
// Get Latvia data
|
||||
console.log("\n=== LATVIA ACCOMMODATIONS ===");
|
||||
const latvia = sourceDb
|
||||
.prepare(
|
||||
`
|
||||
SELECT * FROM accommodations
|
||||
WHERE source_url LIKE '%Latvia%' OR raw_json LIKE '%Latvia%'
|
||||
LIMIT 5
|
||||
`
|
||||
)
|
||||
.all();
|
||||
console.log(JSON.stringify(latvia, null, 2));
|
||||
|
||||
// Search for Riga specifically
|
||||
console.log("\n=== RIGA SEARCH ===");
|
||||
const riga = sourceDb
|
||||
.prepare(
|
||||
`
|
||||
SELECT * FROM accommodations
|
||||
WHERE city LIKE '%Riga%' OR raw_json LIKE '%Riga%'
|
||||
`
|
||||
)
|
||||
.all();
|
||||
console.log(JSON.stringify(riga, null, 2));
|
||||
|
||||
sourceDb.close();
|
||||
Reference in New Issue
Block a user