- Add backend stale process monitoring API (/api/stale-processes) - Add users management route - Add frontend landing page and stale process monitor UI on /scraper-tools - Move old development scripts to backend/archive/ - Update frontend build with new features 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
61 lines
1.7 KiB
TypeScript
61 lines
1.7 KiB
TypeScript
import { Pool } from 'pg';
|
|
|
|
async function syncDispensaries() {
|
|
// Source: sail database
|
|
const sailPool = new Pool({
|
|
connectionString: 'postgresql://sail:password@localhost:5432/dutchie_menus'
|
|
});
|
|
|
|
// Destination: dutchie database
|
|
const dutchiePool = new Pool({
|
|
connectionString: 'postgresql://dutchie:dutchie_local_pass@localhost:54320/dutchie_menus'
|
|
});
|
|
|
|
try {
|
|
console.log('🔄 Syncing enriched dispensary data from sail → dutchie database\n');
|
|
|
|
// Get all enriched dispensaries from sail
|
|
const result = await sailPool.query(`
|
|
SELECT id, name, company_name, slug, address, city, state, zip, phone, email,
|
|
website, dba_name, google_rating, google_review_count, status_line,
|
|
azdhs_url, latitude, longitude
|
|
FROM azdhs_list
|
|
WHERE website IS NOT NULL AND website != ''
|
|
`);
|
|
|
|
console.log(`📋 Found ${result.rows.length} enriched dispensaries to sync\n`);
|
|
|
|
let synced = 0;
|
|
for (const disp of result.rows) {
|
|
await dutchiePool.query(`
|
|
UPDATE azdhs_list
|
|
SET
|
|
website = $1,
|
|
dba_name = $2,
|
|
google_rating = $3,
|
|
google_review_count = $4,
|
|
updated_at = CURRENT_TIMESTAMP
|
|
WHERE id = $5
|
|
`, [
|
|
disp.website,
|
|
disp.dba_name,
|
|
disp.google_rating,
|
|
disp.google_review_count,
|
|
disp.id
|
|
]);
|
|
synced++;
|
|
if (synced % 20 === 0) {
|
|
console.log(` Synced ${synced}/${result.rows.length}...`);
|
|
}
|
|
}
|
|
|
|
console.log(`\n✅ Successfully synced ${synced} dispensaries!`);
|
|
|
|
} finally {
|
|
await sailPool.end();
|
|
await dutchiePool.end();
|
|
}
|
|
}
|
|
|
|
syncDispensaries().catch(console.error);
|