File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ -- name: InsertWorkspaceAppAuditSession :one
2
+ INSERT INTO
3
+ workspace_app_audit_sessions (
4
+ agent_id,
5
+ app_id,
6
+ user_id,
7
+ ip,
8
+ started_at,
9
+ updated_at
10
+ )
11
+ VALUES
12
+ (
13
+ $1 ,
14
+ $2 ,
15
+ $3 ,
16
+ $4 ,
17
+ $5 ,
18
+ $6
19
+ )
20
+ RETURNING
21
+ id;
22
+
23
+ -- name: UpdateWorkspaceAppAuditSession :many
24
+ --
25
+ -- Return ID to determine if a row was updated or not. This table isn't strict
26
+ -- about uniqueness, so we need to know if we updated an existing row or not.
27
+ UPDATE
28
+ workspace_app_audit_sessions
29
+ SET
30
+ updated_at = @updated_at
31
+ WHERE
32
+ agent_id = @agent_id
33
+ AND app_id IS NOT DISTINCT FROM @app_id
34
+ AND user_id IS NOT DISTINCT FROM @user_id
35
+ AND ip IS NOT DISTINCT FROM @ip
36
+ AND updated_at > NOW() - (@stale_interval_ms::bigint || ' ms' )::interval
37
+ RETURNING
38
+ id;
You can’t perform that action at this time.
0 commit comments