Files
cannaiq/backend/reset-jobs.ts
2025-11-28 19:45:44 -07:00

30 lines
707 B
TypeScript

import { pool } from './src/db/migrate.js';
async function resetJobs() {
const result = await pool.query(`
UPDATE brand_scrape_jobs
SET status = 'pending',
worker_id = NULL,
started_at = NULL,
completed_at = NULL,
products_found = 0,
products_saved = 0,
error_message = NULL,
retry_count = 0
WHERE dispensary_id = 112
`);
console.log(`✅ Reset ${result.rowCount} jobs to pending`);
const count = await pool.query(
'SELECT COUNT(*) FROM brand_scrape_jobs WHERE dispensary_id = 112 AND status = $1',
['pending']
);
console.log(`📊 Total pending jobs: ${count.rows[0].count}`);
await pool.end();
}
resetJobs();