Skip to content

Commit

Permalink
backend: v2 schedule_path -> trigger and trigger_kind
Browse files Browse the repository at this point in the history
  • Loading branch information
uael committed Jan 20, 2025
1 parent 539b6d4 commit 0c5ed13
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion backend/migrations/20250117124431_v2_job.down.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ ALTER TABLE v2_job
DROP COLUMN flow_step CASCADE,
DROP COLUMN flow_step_id CASCADE,
DROP COLUMN flow_root_job CASCADE,
DROP COLUMN schedule_path CASCADE,
DROP COLUMN trigger CASCADE,
DROP COLUMN trigger_kind CASCADE,
DROP COLUMN same_worker CASCADE,
DROP COLUMN visible_to_owner CASCADE,
DROP COLUMN concurrent_limit CASCADE,
Expand Down
3 changes: 2 additions & 1 deletion backend/migrations/20250117124431_v2_job.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ ALTER TABLE v2_job
ADD COLUMN IF NOT EXISTS flow_step INTEGER,
ADD COLUMN IF NOT EXISTS flow_step_id VARCHAR(255),
ADD COLUMN IF NOT EXISTS flow_root_job UUID,
ADD COLUMN IF NOT EXISTS schedule_path VARCHAR(255),
ADD COLUMN IF NOT EXISTS trigger VARCHAR(255),
ADD COLUMN IF NOT EXISTS trigger_kind trigger_kind,
ADD COLUMN IF NOT EXISTS same_worker BOOLEAN DEFAULT FALSE NOT NULL,
ADD COLUMN IF NOT EXISTS visible_to_owner BOOLEAN DEFAULT TRUE NOT NULL,
ADD COLUMN IF NOT EXISTS concurrent_limit INTEGER,
Expand Down
6 changes: 3 additions & 3 deletions backend/migrations/20250117124743_v2_job_queue_sync.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ BEGIN
-- __last_ping
NEW.__job_kind := job.kind;
NEW.__env_id := 0xcafe; -- Magic used bellow.
NEW.__schedule_path := job.schedule_path;
NEW.__schedule_path := job.trigger;
NEW.__permissioned_as := job.permissioned_as;
-- __flow_status
NEW.__raw_flow := job.raw_flow;
Expand Down Expand Up @@ -55,7 +55,7 @@ CREATE OR REPLACE FUNCTION v2_job_queue_after_insert() RETURNS TRIGGER AS $$ BEG
kind, runnable_id, runnable_path, parent_job,
script_lang,
flow_step, flow_step_id, flow_root_job,
schedule_path,
trigger,
tag, same_worker, visible_to_owner, concurrent_limit, concurrency_time_window_s, cache_ttl, timeout, priority,
args, pre_run_error,
raw_code, raw_lock, raw_flow
Expand Down Expand Up @@ -83,7 +83,7 @@ CREATE OR REPLACE FUNCTION v2_job_queue_after_insert() RETURNS TRIGGER AS $$ BEG
flow_step = EXCLUDED.flow_step,
flow_step_id = EXCLUDED.flow_step_id,
flow_root_job = EXCLUDED.flow_root_job,
schedule_path = EXCLUDED.schedule_path,
trigger = EXCLUDED.trigger,
tag = EXCLUDED.tag,
same_worker = EXCLUDED.same_worker,
visible_to_owner = EXCLUDED.visible_to_owner,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ BEGIN
NEW.__canceled := NEW.status = 'canceled';
NEW.__job_kind := job.kind;
-- __env_id
NEW.__schedule_path := job.schedule_path;
NEW.__schedule_path := job.trigger;
NEW.__permissioned_as := job.permissioned_as;
NEW.__raw_flow := job.raw_flow;
NEW.__is_flow_step := job.flow_step_id IS NOT NULL;
Expand Down
8 changes: 4 additions & 4 deletions backend/migrations/20250117124748_v2_migrate_from_v1.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ INSERT INTO v2_job (
kind, runnable_id, runnable_path, parent_job,
script_lang,
flow_step_id, flow_root_job,
schedule_path,
trigger,
tag, same_worker, visible_to_owner, concurrent_limit, concurrency_time_window_s, cache_ttl, timeout, priority,
args, pre_run_error,
raw_code, raw_lock, raw_flow
Expand All @@ -38,7 +38,7 @@ INSERT INTO v2_job (
id, workspace_id, created_at, created_by, permissioned_as, permissioned_as_email,
kind, runnable_id, runnable_path, parent_job,
script_lang,
schedule_path,
trigger,
tag, visible_to_owner, priority,
args,
raw_code, raw_lock, raw_flow
Expand Down Expand Up @@ -66,7 +66,7 @@ UPDATE v2_job SET
script_lang = v2_job_queue.__language,
flow_step_id = v2_job_queue.__flow_step_id,
flow_root_job = v2_job_queue.__root_job,
schedule_path = v2_job_queue.__schedule_path,
trigger = v2_job_queue.__schedule_path,
tag = v2_job_queue.tag,
same_worker = v2_job_queue.__same_worker,
visible_to_owner = v2_job_queue.__visible_to_owner,
Expand Down Expand Up @@ -94,7 +94,7 @@ UPDATE v2_job SET
runnable_path = v2_job_completed.__script_path,
parent_job = v2_job_completed.__parent_job,
script_lang = v2_job_completed.__language,
schedule_path = v2_job_completed.__schedule_path,
trigger = v2_job_completed.__schedule_path,
tag = v2_job_completed.__tag,
visible_to_owner = v2_job_completed.__visible_to_owner,
priority = v2_job_completed.__priority,
Expand Down

0 comments on commit 0c5ed13

Please sign in to comment.