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); } })();