-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy path00721.sql
More file actions
15 lines (12 loc) · 792 Bytes
/
00721.sql
File metadata and controls
15 lines (12 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
-- pause_job() will pause the chain (set live = false)
CREATE OR REPLACE FUNCTION timetable.pause_job(IN job_name TEXT) RETURNS boolean AS $$
WITH upd_chain AS (UPDATE timetable.chain SET live = false WHERE chain.chain_name = $1 RETURNING chain_id)
SELECT EXISTS(SELECT 1 FROM upd_chain)
$$ LANGUAGE SQL;
COMMENT ON FUNCTION timetable.pause_job IS 'Pause the chain (set live = false)';
-- resume_job() will resume the chain (set live = true)
CREATE OR REPLACE FUNCTION timetable.resume_job(IN job_name TEXT) RETURNS boolean AS $$
WITH upd_chain AS (UPDATE timetable.chain SET live = true WHERE chain.chain_name = $1 RETURNING chain_id)
SELECT EXISTS(SELECT 1 FROM upd_chain)
$$ LANGUAGE SQL;
COMMENT ON FUNCTION timetable.resume_job IS 'Resume the chain (set live = true)';