create index on task(type, status, policy);
update task
set arguments=jsonb_set(arguments, '{kwargs}', json_build_object('url', arguments#>>'{kwargs,package_url}')::jsonb)
where type = 'load-npm' and
status = 'next_run_not_scheduled'
and policy='recurring';
update task
set arguments = json_build_object('args', '[]', 'kwargs', json_build_object('url', arguments#>>'{args,0}'))
where type = 'load-hg' and
status != 'disabled' and
policy ='recurring';
select json_build_object('args', '[]', 'kwargs', json_build_object('url', arguments#>>'{args,0}'))
from task
where type = 'load-git' and
status != 'disabled' and
policy ='recurring'
limit 10;
update task
set arguments = json_build_object('args', '[]', 'kwargs', json_build_object('url', arguments#>>'{args,0}'))
where type = 'load-git' and
status != 'disabled' and
policy ='recurring';