mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +00:00
feat: add database support for dismissed healthchecks (#10845)
This commit is contained in:
@ -4344,6 +4344,18 @@ func (q *sqlQuerier) GetDeploymentID(ctx context.Context) (string, error) {
|
||||
return value, err
|
||||
}
|
||||
|
||||
const getHealthSettings = `-- name: GetHealthSettings :one
|
||||
SELECT
|
||||
COALESCE((SELECT value FROM site_configs WHERE key = 'health_settings'), '{}') :: text AS health_settings
|
||||
`
|
||||
|
||||
func (q *sqlQuerier) GetHealthSettings(ctx context.Context) (string, error) {
|
||||
row := q.db.QueryRowContext(ctx, getHealthSettings)
|
||||
var health_settings string
|
||||
err := row.Scan(&health_settings)
|
||||
return health_settings, err
|
||||
}
|
||||
|
||||
const getLastUpdateCheck = `-- name: GetLastUpdateCheck :one
|
||||
SELECT value FROM site_configs WHERE key = 'last_update_check'
|
||||
`
|
||||
@ -4449,6 +4461,16 @@ func (q *sqlQuerier) UpsertDefaultProxy(ctx context.Context, arg UpsertDefaultPr
|
||||
return err
|
||||
}
|
||||
|
||||
const upsertHealthSettings = `-- name: UpsertHealthSettings :exec
|
||||
INSERT INTO site_configs (key, value) VALUES ('health_settings', $1)
|
||||
ON CONFLICT (key) DO UPDATE SET value = $1 WHERE site_configs.key = 'health_settings'
|
||||
`
|
||||
|
||||
func (q *sqlQuerier) UpsertHealthSettings(ctx context.Context, value string) error {
|
||||
_, err := q.db.ExecContext(ctx, upsertHealthSettings, value)
|
||||
return err
|
||||
}
|
||||
|
||||
const upsertLastUpdateCheck = `-- name: UpsertLastUpdateCheck :exec
|
||||
INSERT INTO site_configs (key, value) VALUES ('last_update_check', $1)
|
||||
ON CONFLICT (key) DO UPDATE SET value = $1 WHERE site_configs.key = 'last_update_check'
|
||||
|
Reference in New Issue
Block a user