14 lines
389 B
SQL
14 lines
389 B
SQL
|
|
UPDATE desktop_tasks
|
||
|
|
SET status = 'failed',
|
||
|
|
updated_at = NOW()
|
||
|
|
WHERE kind = 'monitor'
|
||
|
|
AND status = 'unknown';
|
||
|
|
|
||
|
|
DROP INDEX IF EXISTS uq_desktop_tasks_monitor_active;
|
||
|
|
|
||
|
|
CREATE UNIQUE INDEX IF NOT EXISTS uq_desktop_tasks_monitor_active
|
||
|
|
ON desktop_tasks (monitor_task_id)
|
||
|
|
WHERE kind = 'monitor'
|
||
|
|
AND monitor_task_id IS NOT NULL
|
||
|
|
AND status IN ('queued', 'in_progress');
|