mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(coderd): add last_seen_at and version to provisioner_daemons table (#11033)
Related to #10676 - Adds columns last_seen_at and version to provisioner_daemons table - Adds the above to codersdk.ProvisionerDaemons struct
This commit is contained in:
Generated
+3
-1
@@ -513,7 +513,9 @@ CREATE TABLE provisioner_daemons (
|
||||
name character varying(64) NOT NULL,
|
||||
provisioners provisioner_type[] NOT NULL,
|
||||
replica_id uuid,
|
||||
tags jsonb DEFAULT '{}'::jsonb NOT NULL
|
||||
tags jsonb DEFAULT '{}'::jsonb NOT NULL,
|
||||
last_seen_at timestamp with time zone,
|
||||
version text DEFAULT ''::text NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE provisioner_job_logs (
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE provisioner_daemons
|
||||
DROP COLUMN last_seen_at,
|
||||
DROP COLUMN version;
|
||||
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE provisioner_daemons
|
||||
ADD COLUMN last_seen_at TIMESTAMP WITH TIME ZONE NULL,
|
||||
ADD COLUMN version TEXT NOT NULL DEFAULT ''::TEXT;
|
||||
@@ -1844,6 +1844,8 @@ type ProvisionerDaemon struct {
|
||||
Provisioners []ProvisionerType `db:"provisioners" json:"provisioners"`
|
||||
ReplicaID uuid.NullUUID `db:"replica_id" json:"replica_id"`
|
||||
Tags StringMap `db:"tags" json:"tags"`
|
||||
LastSeenAt sql.NullTime `db:"last_seen_at" json:"last_seen_at"`
|
||||
Version string `db:"version" json:"version"`
|
||||
}
|
||||
|
||||
type ProvisionerJob struct {
|
||||
|
||||
@@ -3004,7 +3004,7 @@ func (q *sqlQuerier) DeleteOldProvisionerDaemons(ctx context.Context) error {
|
||||
|
||||
const getProvisionerDaemons = `-- name: GetProvisionerDaemons :many
|
||||
SELECT
|
||||
id, created_at, updated_at, name, provisioners, replica_id, tags
|
||||
id, created_at, updated_at, name, provisioners, replica_id, tags, last_seen_at, version
|
||||
FROM
|
||||
provisioner_daemons
|
||||
`
|
||||
@@ -3026,6 +3026,8 @@ func (q *sqlQuerier) GetProvisionerDaemons(ctx context.Context) ([]ProvisionerDa
|
||||
pq.Array(&i.Provisioners),
|
||||
&i.ReplicaID,
|
||||
&i.Tags,
|
||||
&i.LastSeenAt,
|
||||
&i.Version,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -3051,7 +3053,7 @@ INSERT INTO
|
||||
updated_at
|
||||
)
|
||||
VALUES
|
||||
($1, $2, $3, $4, $5, $6) RETURNING id, created_at, updated_at, name, provisioners, replica_id, tags
|
||||
($1, $2, $3, $4, $5, $6) RETURNING id, created_at, updated_at, name, provisioners, replica_id, tags, last_seen_at, version
|
||||
`
|
||||
|
||||
type InsertProvisionerDaemonParams struct {
|
||||
@@ -3081,6 +3083,8 @@ func (q *sqlQuerier) InsertProvisionerDaemon(ctx context.Context, arg InsertProv
|
||||
pq.Array(&i.Provisioners),
|
||||
&i.ReplicaID,
|
||||
&i.Tags,
|
||||
&i.LastSeenAt,
|
||||
&i.Version,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user