mirror of
https://github.com/n8n-io/n8n.git
synced 2026-12-05 09:11:11 +00:00
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
4.9 KiB
Generated
4.9 KiB
Generated
public.assistant_usage_event
Columns
| Name | Type | Default | Nullable | Children | Parents | Comment |
|---|---|---|---|---|---|---|
| cacheReadTokens | integer | true | Input tokens read from the prompt cache. Only for tokens-used | |||
| cacheWriteTokens | integer | true | Input tokens written to the prompt cache. Only for tokens-used | |||
| createdAt | timestamp(3) with time zone | CURRENT_TIMESTAMP(3) | false | |||
| data | json | true | Details of the event, such as the rating of a rated response. Never user data | |||
| id | integer | false | ||||
| inputTokens | integer | true | Input tokens, cache reads and writes included. Only for tokens-used | |||
| model | varchar(128) | true | Model of the calls, such as anthropic/claude-sonnet-5-5. Only for tokens-used | |||
| outputTokens | integer | true | Output tokens. Only for tokens-used | |||
| projectId | varchar(36) | true | public.project | Project of the resource, else the working project of the thread. NULL after the project is deleted | ||
| resourceId | varchar(64) | true | ID of the resource that the event names. Kept after the resource is deleted | |||
| resourceType | varchar(32) | true | Type of the resource that the event names, such as workflow | |||
| threadId | varchar(128) | false | Agents runtime thread of the conversation. Kept after the thread is deleted | |||
| type | varchar(64) | false | What happened, such as message-sent, resource-created or tokens-used. See AssistantUsageEventType | |||
| userId | uuid | true | public.user | User of the conversation. NULL after the user is deleted |
Constraints
| Name | Type | Definition |
|---|---|---|
| FK_32769c0d4eea8fa85c539ad6356 | FOREIGN KEY | FOREIGN KEY ("userId") REFERENCES "user"(id) ON DELETE SET NULL |
| FK_3442c145d6d184730643dacebb4 | FOREIGN KEY | FOREIGN KEY ("projectId") REFERENCES project(id) ON DELETE SET NULL |
| PK_0f886448c5262f8e3f7b27b00eb | PRIMARY KEY | PRIMARY KEY (id) |
| assistant_usage_event_createdAt_not_null | n | NOT NULL "createdAt" |
| assistant_usage_event_id_not_null | n | NOT NULL id |
| assistant_usage_event_threadId_not_null | n | NOT NULL "threadId" |
| assistant_usage_event_type_not_null | n | NOT NULL type |
Indexes
| Name | Definition |
|---|---|
| IDX_32769c0d4eea8fa85c539ad635 | CREATE INDEX "IDX_32769c0d4eea8fa85c539ad635" ON public.assistant_usage_event USING btree ("userId") |
| IDX_assistant_usage_event_modified | CREATE UNIQUE INDEX "IDX_assistant_usage_event_modified" ON public.assistant_usage_event USING btree ("resourceType", "resourceId", "threadId") WHERE ((type)::text = 'resource-modified'::text) |
| IDX_assistant_usage_event_resource | CREATE UNIQUE INDEX "IDX_assistant_usage_event_resource" ON public.assistant_usage_event USING btree ("resourceType", "resourceId") WHERE ((type)::text = 'resource-created'::text) |
| IDX_b4b7423ae2a4840793865b7913 | CREATE INDEX "IDX_b4b7423ae2a4840793865b7913" ON public.assistant_usage_event USING btree ("projectId", "createdAt") |
| IDX_de48a3665b0da1f8356733f54a | CREATE INDEX "IDX_de48a3665b0da1f8356733f54a" ON public.assistant_usage_event USING btree ("createdAt") |
| IDX_e5292697ff0c1345783a4e2848 | CREATE INDEX "IDX_e5292697ff0c1345783a4e2848" ON public.assistant_usage_event USING btree ("threadId") |
| PK_0f886448c5262f8e3f7b27b00eb | CREATE UNIQUE INDEX "PK_0f886448c5262f8e3f7b27b00eb" ON public.assistant_usage_event USING btree (id) |
Relations
erDiagram
"public.assistant_usage_event" }o--o| "public.project" : "FOREIGN KEY (#quot;projectId#quot;) REFERENCES project(id) ON DELETE SET NULL"
"public.assistant_usage_event" }o--o| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE SET NULL"
"public.assistant_usage_event" {
integer cacheReadTokens
integer cacheWriteTokens
timestamp_3__with_time_zone createdAt
json data
integer id
integer inputTokens
varchar_128_ model
integer outputTokens
varchar_36_ projectId FK
varchar_64_ resourceId
varchar_32_ resourceType
varchar_128_ threadId
varchar_64_ type
uuid userId FK
}
"public.project" {
timestamp_3__with_time_zone createdAt
uuid creatorId FK
json customTelemetryTags
varchar_512_ description
json icon
varchar_36_ id
varchar_255_ name
varchar_36_ type
timestamp_3__with_time_zone updatedAt
}
"public.user" {
timestamp_3__with_time_zone createdAt
boolean disabled
varchar_255_ email
varchar_32_ firstName
uuid id
varchar_16_ kind
date lastActiveAt
varchar_32_ lastName
boolean mfaEnabled
text mfaRecoveryCodes
text mfaSecret
varchar_255_ password
json personalizationAnswers
varchar_128_ roleSlug FK
integer sessionGeneration
json settings
timestamp_3__with_time_zone updatedAt
}
Generated by tbls