You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d31d0af
Browse filesBrowse the repository at this point in the historyBrowse files
refactor: copy query schema from control-plane instead of generating locally
- Remove internal/chat/tools/generate/ directory (annotate.go, comments.go, main.go)
- Remove go:generate directive from query.go
- Taskfile copies schema.sql from control-plane repo
- Schema is now generated in control-plane with enum values and rich comments
-- *_cache - Pre-computed status and metrics (query these for current state)
15
13
--
16
-
-- IMPORTANT: All queries are READ-ONLY. This is a local sync of server data.
17
-
14
+
-- All queries are READ-ONLY. This is a local sync of server data.
18
15
19
16
CREATETABLEconversation_contexts (
20
17
id TEXT, -- Unique identifier
21
18
account_id TEXT, -- Denormalized for tenant isolation. Auto-set via trigger from conversation.account_id.
22
-
added_by TEXT, -- Who added this entity to context
19
+
added_by TEXT, -- Who added this entity to context Values: user, assistant.
23
20
conversation_id TEXT, -- Conversation this context belongs to
24
21
created_at TEXT, -- When the entity was added to context
25
22
entity_id TEXT, -- ID of the context entity
26
-
entity_type TEXT-- Type of the context entity
23
+
entity_type TEXT-- Type of the context entity Values: service, log_event.
27
24
);
28
25
29
26
CREATETABLEconversations (
@@ -33,9 +30,11 @@ CREATE TABLE conversations (
33
30
title TEXT, -- AI-generated title, set after first exchange
34
31
updated_at TEXT, -- When the conversation was last updated
35
32
user_id TEXT, -- WorkOS user ID who owns this conversation
33
+
view_id TEXT, -- If set, this conversation is for iterating on a specific view
36
34
workspace_id TEXT-- Workspace this conversation belongs to
37
35
);
38
36
37
+
-- Aggregated status for each Datadog account based on service statuses. Status progression: DISABLED (all services disabled) > INACTIVE (all services zero volume) > BROKEN (any service broken) > STALE (any service stale) > DISCOVERING (any service discovering) > ANALYZING (any service analyzing) > READY (all services ready).
39
38
CREATETABLEdatadog_account_statuses_cache (
40
39
id TEXT,
41
40
account_id TEXT, -- Account ID (denormalized from Datadog account)
@@ -73,7 +72,7 @@ CREATE TABLE datadog_accounts (
73
72
account_id TEXT, -- Parent account this configuration belongs to
74
73
created_at TEXT, -- When the Datadog account was created
75
74
name TEXT, -- Display name for this Datadog account
76
-
site TEXT, -- Datadog site for this account (must be explicit)
75
+
site TEXT, -- Datadog site for this account (must be explicit) Values: US1, US3, US5, EU1, US1_FED, AP1, AP2.
77
76
updated_at TEXT-- When the Datadog account was last updated
dismissed_at TEXT, -- When this policy was dismissed by a user
116
116
dismissed_by TEXT, -- User ID who dismissed this policy
117
117
log_event_id TEXT, -- The log event this policy applies to
118
118
model TEXT, -- AI model that generated this policy (e.g., 'claude-sonnet-4-20250514')
119
+
objectivity TEXT, -- How verifiable is this finding? factual: user can confirm by looking at the data, reasoned: requires AI judgment. Auto-set by trigger from category.
120
+
risk_level TEXT, -- How bad is it if this policy is wrong? low: safe to apply, medium: review recommended, high: could break things. Set by AI per finding.
119
121
updated_at TEXT, -- When this policy was last updated
120
122
workspace_id TEXT-- The workspace that owns this policy
121
123
);
122
124
125
+
-- Policy recommendations with status and estimated savings. Shows whether each policy is pending (WASTE), approved (SAVED), or rejected (DISMISSED), along with volume and bytes saved per hour.
123
126
CREATETABLElog_event_policy_statuses_cache (
124
127
id TEXT,
125
128
account_id TEXT, -- Account ID for tenant isolation
workspace_id TEXT-- The workspace that owns this policy
136
139
);
137
140
141
+
-- Current status of each log event based on discovery and analysis state. Status progression: BROKEN (discovery errors) > SAVED (policy approved) > VALUABLE (analyzed, no issues) > WASTE (issues found, pending action) > ANALYZING (has volumes, awaiting analysis) > DISCOVERING (no volumes yet).
138
142
CREATETABLElog_event_statuses_cache (
139
143
id TEXT,
140
144
account_id TEXT, -- Account ID for tenant isolation
@@ -185,7 +189,7 @@ CREATE TABLE messages (
185
189
conversation_id TEXT, -- Conversation this message belongs to
186
190
created_at TEXT, -- When the message was created
187
191
model TEXT, -- AI model that produced this message. Null for user messages.
188
-
role TEXT, -- Who sent this message.
192
+
role TEXT, -- Who sent this message. Values: user, assistant.
189
193
stop_reason TEXT-- Why the assistant stopped: end_turn, tool_use. Null for user messages.
volume_per_hour INTEGER-- Log volume for this service during this hour
201
205
);
202
206
207
+
-- Aggregated status for each service based on log event statuses. Status progression: DISABLED (user turned off) > INACTIVE (zero volume) > BROKEN (discovery errors) > STALE (data older than 48h) > DISCOVERING (coverage < 90%) > ANALYZING (log events being analyzed) > READY (all log events terminal).
203
208
CREATETABLEservice_statuses_cache (
204
209
id TEXT,
205
210
account_id TEXT, -- Account ID (denormalized from service)
@@ -246,12 +251,32 @@ CREATE TABLE teams (
246
251
workspace_id TEXT-- Parent workspace this team belongs to
247
252
);
248
253
254
+
CREATETABLEview_favorites (
255
+
id TEXT, -- Unique identifier
256
+
account_id TEXT, -- Denormalized for tenant isolation. Auto-set via trigger from view.account_id.
257
+
created_at TEXT, -- When the view was favorited
258
+
user_id TEXT, -- WorkOS user ID who favorited this view
259
+
view_id TEXT-- The view being favorited
260
+
);
261
+
262
+
CREATETABLEviews (
263
+
id TEXT, -- Unique identifier
264
+
account_id TEXT, -- Denormalized for tenant isolation. Auto-set via trigger from message.account_id.
265
+
conversation_id TEXT, -- Denormalized from message for easier queries
266
+
created_at TEXT, -- When the view was created
267
+
created_by TEXT, -- WorkOS user ID who triggered this view creation
268
+
entity_type TEXT, -- Which catalog entity this view queries Values: service, log_event, policy.
269
+
forked_from_id TEXT, -- Parent view if this is a refinement/iteration
270
+
message_id TEXT, -- Assistant message that created this view via show_view tool call
271
+
query TEXT-- Raw SQL query executed against the client's local SQLite database
272
+
);
273
+
249
274
CREATETABLEworkspaces (
250
275
id TEXT, -- Unique identifier of the workspace
251
276
account_id TEXT, -- Parent account this workspace belongs to
252
277
created_at TEXT, -- When the workspace was created
253
278
name TEXT, -- Human-readable name within the account
0 commit comments