File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,12 @@ var Migrations func() migrator.Option = func() migrator.Option {
141141 return ExecuteMigrationScript (ctx , tx , "00629.sql" )
142142 },
143143 },
144+ & migrator.Migration {
145+ Name : "00721 Add more job control functions" ,
146+ Func : func (ctx context.Context , tx pgx.Tx ) error {
147+ return ExecuteMigrationScript (ctx , tx , "00721.sql" )
148+ },
149+ },
144150 // adding new migration here, update "timetable"."migration" in "sql/init.sql"
145151 // and "dbapi" variable in main.go!
146152
Original file line number Diff line number Diff line change 1+ -- pause_job() will pause the chain (set live = false)
2+ CREATE OR REPLACE FUNCTION timetable .pause_job(IN job_name TEXT ) RETURNS boolean AS $$
3+ WITH upd_chain AS (UPDATE timetable .chain SET live = false WHERE chain .chain_name = $1 RETURNING chain_id)
4+ SELECT EXISTS(SELECT 1 FROM upd_chain)
5+ $$ LANGUAGE SQL;
6+
7+ COMMENT ON FUNCTION timetable.pause_job IS ' Pause the chain (set live = false)' ;
8+
9+ -- resume_job() will resume the chain (set live = true)
10+ CREATE OR REPLACE FUNCTION timetable .resume_job(IN job_name TEXT ) RETURNS boolean AS $$
11+ WITH upd_chain AS (UPDATE timetable .chain SET live = true WHERE chain .chain_name = $1 RETURNING chain_id)
12+ SELECT EXISTS(SELECT 1 FROM upd_chain)
13+ $$ LANGUAGE SQL;
14+
15+ COMMENT ON FUNCTION timetable.resume_job IS ' Resume the chain (set live = true)' ;
You can’t perform that action at this time.
0 commit comments