|
| 1 | +SET search_path TO schedule; |
| 2 | + |
| 3 | +DROP VIEW job_status; |
| 4 | +DROP VIEW all_job_status; |
| 5 | + |
| 6 | +ALTER TABLE at_jobs_submitted ALTER id TYPE bigint; |
| 7 | +ALTER TABLE at_jobs_process ALTER id TYPE bigint; |
| 8 | +ALTER TABLE at_jobs_done ALTER id TYPE bigint; |
| 9 | + |
| 10 | +CREATE VIEW job_status AS |
| 11 | + SELECT |
| 12 | + id, node, name, comments, at as run_after, |
| 13 | + do_sql as query, params, depends_on, executor as run_as, attempt, |
| 14 | + resubmit_limit, postpone as max_wait_interval, |
| 15 | + max_run_time as max_duration, submit_time, canceled, |
| 16 | + start_time, status as is_success, reason as error, done_time, |
| 17 | + 'done'::job_at_status_t status |
| 18 | + FROM schedule.at_jobs_done where owner = session_user |
| 19 | + UNION |
| 20 | + SELECT |
| 21 | + id, node, name, comments, at as run_after, |
| 22 | + do_sql as query, params, depends_on, executor as run_as, attempt, |
| 23 | + resubmit_limit, postpone as max_wait_interval, |
| 24 | + max_run_time as max_duration, submit_time, canceled, start_time, |
| 25 | + NULL as is_success, NULL as error, NULL as done_time, |
| 26 | + 'processing'::job_at_status_t status |
| 27 | + FROM ONLY schedule.at_jobs_process where owner = session_user |
| 28 | + UNION |
| 29 | + SELECT |
| 30 | + id, node, name, comments, at as run_after, |
| 31 | + do_sql as query, params, depends_on, executor as run_as, attempt, |
| 32 | + resubmit_limit, postpone as max_wait_interval, |
| 33 | + max_run_time as max_duration, submit_time, canceled, |
| 34 | + NULL as start_time, NULL as is_success, NULL as error, |
| 35 | + NULL as done_time, |
| 36 | + 'submitted'::job_at_status_t status |
| 37 | + FROM ONLY schedule.at_jobs_submitted where owner = session_user; |
| 38 | + |
| 39 | +CREATE VIEW all_job_status AS |
| 40 | + SELECT |
| 41 | + id, node, name, comments, at as run_after, |
| 42 | + do_sql as query, params, depends_on, executor as run_as, owner, |
| 43 | + attempt, resubmit_limit, postpone as max_wait_interval, |
| 44 | + max_run_time as max_duration, submit_time, canceled, |
| 45 | + start_time, status as is_success, reason as error, done_time, |
| 46 | + 'done'::job_at_status_t status |
| 47 | + FROM schedule.at_jobs_done |
| 48 | + UNION |
| 49 | + SELECT |
| 50 | + id, node, name, comments, at as run_after, |
| 51 | + do_sql as query, params, depends_on, executor as run_as, owner, |
| 52 | + attempt, resubmit_limit, postpone as max_wait_interval, |
| 53 | + max_run_time as max_duration, submit_time, canceled, start_time, |
| 54 | + NULL as is_success, NULL as error, NULL as done_time, |
| 55 | + 'processing'::job_at_status_t status |
| 56 | + FROM ONLY schedule.at_jobs_process |
| 57 | + UNION |
| 58 | + SELECT |
| 59 | + id, node, name, comments, at as run_after, |
| 60 | + do_sql as query, params, depends_on, executor as run_as, owner, |
| 61 | + attempt, resubmit_limit, postpone as max_wait_interval, |
| 62 | + max_run_time as max_duration, submit_time, canceled, |
| 63 | + NULL as start_time, NULL as is_success, NULL as error, |
| 64 | + NULL as done_time, |
| 65 | + 'submitted'::job_at_status_t status |
| 66 | + FROM ONLY schedule.at_jobs_submitted; |
| 67 | + |
| 68 | +GRANT SELECT ON schedule.job_status TO public; |
| 69 | + |
| 70 | +RESET search_path; |
0 commit comments