-- easyai:migration:no-transaction CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_gateway_task_callback_outbox_stale ON gateway_task_callback_outbox(status, locked_at) WHERE status = 'processing'; -- easyai:migration:statement CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_gateway_task_callback_outbox_delivered_retention ON gateway_task_callback_outbox(delivered_at, id) WHERE status = 'delivered'; -- easyai:migration:statement CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_gateway_task_callback_outbox_failed_retention ON gateway_task_callback_outbox(failed_at, id) WHERE status = 'failed'; -- easyai:migration:statement CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_gateway_task_callback_outbox_payload_compaction ON gateway_task_callback_outbox(created_at, id) WHERE payload <> '{}'::jsonb; -- easyai:migration:statement CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_gateway_task_callback_outbox_legacy ON gateway_task_callback_outbox(created_at, id) WHERE status IN ('pending', 'processing');