@@ -512,27 +512,29 @@ WHERE
512
512
RETURNING * ;
513
513
514
514
-- name: UpdateWorkspaceAutostart :exec
515
- -- NOTE: This query should only be called for regular user workspaces.
516
- -- Prebuilds are managed by the reconciliation loop, not the lifecycle
517
- -- executor which handles autostart_schedule and next_start_at.
518
515
UPDATE
519
516
workspaces
520
517
SET
521
518
autostart_schedule = $2 ,
522
519
next_start_at = $3
523
520
WHERE
524
- id = $1 ;
521
+ id = $1
522
+ -- Prebuilt workspaces (identified by having the prebuilds system user as owner_id)
523
+ -- are managed by the reconciliation loop, not the lifecycle executor which handles
524
+ -- autostart_schedule and next_start_at
525
+ AND owner_id != ' c42fdf75-3097-471c-8c33-fb52454d81c0' ::UUID;
525
526
526
527
-- name: UpdateWorkspaceNextStartAt :exec
527
- -- NOTE: This query should only be called for regular user workspaces.
528
- -- Prebuilds are managed by the reconciliation loop, not the lifecycle
529
- -- executor which handles next_start_at.
530
528
UPDATE
531
529
workspaces
532
530
SET
533
531
next_start_at = $2
534
532
WHERE
535
- id = $1 ;
533
+ id = $1
534
+ -- Prebuilt workspaces (identified by having the prebuilds system user as owner_id)
535
+ -- are managed by the reconciliation loop, not the lifecycle executor which handles
536
+ -- next_start_at
537
+ AND owner_id != ' c42fdf75-3097-471c-8c33-fb52454d81c0' ::UUID;
536
538
537
539
-- name: BatchUpdateWorkspaceNextStartAt :exec
538
540
UPDATE
@@ -551,15 +553,16 @@ WHERE
551
553
workspaces .id = batch .id ;
552
554
553
555
-- name: UpdateWorkspaceTTL :exec
554
- -- NOTE: This query should only be called for regular user workspaces.
555
- -- Prebuilds are managed by the reconciliation loop, not the lifecycle
556
- -- executor which handles regular workspace's TTL.
557
556
UPDATE
558
557
workspaces
559
558
SET
560
559
ttl = $2
561
560
WHERE
562
- id = $1 ;
561
+ id = $1
562
+ -- Prebuilt workspaces (identified by having the prebuilds system user as owner_id)
563
+ -- are managed by the reconciliation loop, not the lifecycle executor which handles
564
+ -- ttl
565
+ AND owner_id != ' c42fdf75-3097-471c-8c33-fb52454d81c0' ::UUID;
563
566
564
567
-- name: UpdateWorkspacesTTLByTemplateID :exec
565
568
UPDATE
@@ -777,9 +780,6 @@ WHERE
777
780
AND workspaces .owner_id != ' c42fdf75-3097-471c-8c33-fb52454d81c0' ::UUID;
778
781
779
782
-- name: UpdateWorkspaceDormantDeletingAt :one
780
- -- NOTE: This query should only be called for regular user workspaces.
781
- -- Prebuilds are managed by the reconciliation loop, not the lifecycle
782
- -- executor which handles dormant_at and deleting_at.
783
783
UPDATE
784
784
workspaces
785
785
SET
@@ -803,6 +803,10 @@ FROM
803
803
WHERE
804
804
workspaces .id = $1
805
805
AND templates .id = workspaces .template_id
806
+ -- Prebuilt workspaces (identified by having the prebuilds system user as owner_id)
807
+ -- are managed by the reconciliation loop, not the lifecycle executor which handles
808
+ -- dormant_at and deleting_at
809
+ AND owner_id != ' c42fdf75-3097-471c-8c33-fb52454d81c0' ::UUID
806
810
RETURNING
807
811
workspaces.* ;
808
812
0 commit comments