mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: add audit log entry when ai seat is consumed (#22683)
When an ai seat is consumed, an audit log entry is made. This only happens the first time a seat is used.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
-- name: UpsertAISeatState :exec
|
||||
-- name: UpsertAISeatState :one
|
||||
-- Returns true if a new rows was inserted, false otherwise.
|
||||
INSERT INTO ai_seat_state (
|
||||
user_id,
|
||||
first_used_at,
|
||||
@@ -15,7 +16,9 @@ SET
|
||||
last_event_type = EXCLUDED.last_event_type,
|
||||
last_event_description = EXCLUDED.last_event_description,
|
||||
updated_at = EXCLUDED.updated_at
|
||||
;
|
||||
RETURNING
|
||||
-- Postgres vodoo to know if a row was inserted.
|
||||
(xmax = 0)::boolean AS is_new;
|
||||
|
||||
-- name: GetActiveAISeatCount :one
|
||||
SELECT
|
||||
|
||||
Reference in New Issue
Block a user