19 lines
491 B
JavaScript
19 lines
491 B
JavaScript
const db = require('/app/dist/db/connection');
|
|
(async () => {
|
|
const rows = await db.query(
|
|
`UPDATE candle_predict_bets b
|
|
SET status = 'refunded'
|
|
FROM users u
|
|
WHERE b.user_id = u.id
|
|
AND u.first_name LIKE 'loadtest_%'
|
|
AND b.prediction_mode = 'multi_candle'
|
|
AND b.status = 'in_progress'
|
|
RETURNING b.id`
|
|
);
|
|
console.log(JSON.stringify({ cleared: rows.length }));
|
|
process.exit(0);
|
|
})().catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
});
|