- 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>
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
const { Pool } = require('pg');
|
|
|
|
const pool = new Pool({
|
|
connectionString: process.env.DATABASE_URL
|
|
});
|
|
|
|
(async () => {
|
|
try {
|
|
await pool.query(`
|
|
CREATE TABLE IF NOT EXISTS proxy_test_jobs (
|
|
id SERIAL PRIMARY KEY,
|
|
status VARCHAR(20) NOT NULL DEFAULT 'pending',
|
|
total_proxies INTEGER NOT NULL DEFAULT 0,
|
|
tested_proxies INTEGER NOT NULL DEFAULT 0,
|
|
passed_proxies INTEGER NOT NULL DEFAULT 0,
|
|
failed_proxies INTEGER NOT NULL DEFAULT 0,
|
|
started_at TIMESTAMP,
|
|
completed_at TIMESTAMP,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
`);
|
|
|
|
await pool.query(`
|
|
CREATE INDEX IF NOT EXISTS idx_proxy_test_jobs_status ON proxy_test_jobs(status);
|
|
`);
|
|
|
|
await pool.query(`
|
|
CREATE INDEX IF NOT EXISTS idx_proxy_test_jobs_created_at ON proxy_test_jobs(created_at DESC);
|
|
`);
|
|
|
|
console.log('✅ Table created successfully');
|
|
process.exit(0);
|
|
} catch (error) {
|
|
console.error('❌ Error:', error);
|
|
process.exit(1);
|
|
}
|
|
})();
|