- 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>
46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
const { Pool } = require('pg');
|
|
|
|
const pool = new Pool({
|
|
connectionString: process.env.DATABASE_URL || 'postgresql://kelly:kelly@localhost:5432/hub'
|
|
});
|
|
|
|
(async () => {
|
|
try {
|
|
console.log('🔄 Running location migration...');
|
|
|
|
await pool.query(`
|
|
ALTER TABLE proxies
|
|
ADD COLUMN IF NOT EXISTS city VARCHAR(100),
|
|
ADD COLUMN IF NOT EXISTS state VARCHAR(100),
|
|
ADD COLUMN IF NOT EXISTS country VARCHAR(100),
|
|
ADD COLUMN IF NOT EXISTS country_code VARCHAR(2),
|
|
ADD COLUMN IF NOT EXISTS location_updated_at TIMESTAMP
|
|
`);
|
|
|
|
console.log('✅ Added columns to proxies table');
|
|
|
|
await pool.query(`
|
|
CREATE INDEX IF NOT EXISTS idx_proxies_location ON proxies(country_code, state, city)
|
|
`);
|
|
|
|
console.log('✅ Created location index');
|
|
|
|
await pool.query(`
|
|
ALTER TABLE failed_proxies
|
|
ADD COLUMN IF NOT EXISTS city VARCHAR(100),
|
|
ADD COLUMN IF NOT EXISTS state VARCHAR(100),
|
|
ADD COLUMN IF NOT EXISTS country VARCHAR(100),
|
|
ADD COLUMN IF NOT EXISTS country_code VARCHAR(2),
|
|
ADD COLUMN IF NOT EXISTS location_updated_at TIMESTAMP
|
|
`);
|
|
|
|
console.log('✅ Added columns to failed_proxies table');
|
|
console.log('✅ Migration complete!');
|
|
|
|
process.exit(0);
|
|
} catch (error) {
|
|
console.error('❌ Migration failed:', error);
|
|
process.exit(1);
|
|
}
|
|
})();
|