Skip to content

Commit db88a16

Browse files
committed
simplify a path
1 parent 74643db commit db88a16

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

packages/database/supabase/migrations/20251216222945_sync_last_success_start.sql

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,8 @@ BEGIN
6969
ON CONFLICT (sync_target, sync_function) DO NOTHING
7070
RETURNING id INTO s_id;
7171
IF s_id IS NOT NULL THEN
72-
-- totally new_row, I'm on the task
73-
-- return last time it was run successfully
74-
SELECT max(last_task_start) INTO result FROM public.sync_info
75-
WHERE sync_target = s_target
76-
AND sync_function = s_function
77-
AND status = 'complete';
78-
RETURN result;
72+
-- totally new_row, no previous success.
73+
RETURN NULL;
7974
END IF;
8075
-- now we know it pre-existed. Maybe already active.
8176
SELECT id INTO STRICT s_id

packages/database/supabase/schemas/sync.sql

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,8 @@ BEGIN
125125
ON CONFLICT (sync_target, sync_function) DO NOTHING
126126
RETURNING id INTO s_id;
127127
IF s_id IS NOT NULL THEN
128-
-- totally new_row, I'm on the task
129-
-- return last time it was run successfully
130-
SELECT max(last_task_start) INTO result FROM public.sync_info
131-
WHERE sync_target = s_target
132-
AND sync_function = s_function
133-
AND status = 'complete';
134-
RETURN result;
128+
-- totally new_row, no previous success.
129+
RETURN NULL;
135130
END IF;
136131
-- now we know it pre-existed. Maybe already active.
137132
SELECT id INTO STRICT s_id

0 commit comments

Comments
 (0)