mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(coderd/database): remove column updated_at from provisioner_daemons table (#11108)
This commit is contained in:
@@ -12,7 +12,7 @@ INSERT INTO
|
||||
"name",
|
||||
provisioners,
|
||||
tags,
|
||||
updated_at
|
||||
last_seen_at
|
||||
)
|
||||
VALUES
|
||||
($1, $2, $3, $4, $5, $6) RETURNING *;
|
||||
@@ -20,9 +20,9 @@ VALUES
|
||||
-- name: DeleteOldProvisionerDaemons :exec
|
||||
-- Delete provisioner daemons that have been created at least a week ago
|
||||
-- and have not connected to coderd since a week.
|
||||
-- A provisioner daemon with "zeroed" updated_at column indicates possible
|
||||
-- A provisioner daemon with "zeroed" last_seen_at column indicates possible
|
||||
-- connectivity issues (no provisioner daemon activity since registration).
|
||||
DELETE FROM provisioner_daemons WHERE (
|
||||
(created_at < (NOW() - INTERVAL '7 days') AND updated_at IS NULL) OR
|
||||
(updated_at IS NOT NULL AND updated_at < (NOW() - INTERVAL '7 days'))
|
||||
(created_at < (NOW() - INTERVAL '7 days') AND last_seen_at IS NULL) OR
|
||||
(last_seen_at IS NOT NULL AND last_seen_at < (NOW() - INTERVAL '7 days'))
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user