Drop unused thread_id from questions
This commit is contained in:
@@ -20,9 +20,9 @@ func (s *Store) CreateInboxItem(ctx context.Context, item api.InboxItem) error {
|
||||
}
|
||||
|
||||
_, err = tx.ExecContext(ctx, `
|
||||
INSERT INTO inbox_items (id, project_id, task_id, agent_session_id, thread_id, payload, state, created_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
`, item.Id, item.ProjectId, item.TaskId, item.AgentSessionId, item.ThreadId,
|
||||
INSERT INTO inbox_items (id, project_id, task_id, agent_session_id, payload, state, created_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
`, item.Id, item.ProjectId, item.TaskId, item.AgentSessionId,
|
||||
string(payload), string(item.State), formatTime(item.CreatedAt))
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -44,9 +44,9 @@ func (s *Store) CreateAnsweredItem(ctx context.Context, item api.InboxItem, resp
|
||||
}
|
||||
|
||||
_, err = tx.ExecContext(ctx, `
|
||||
INSERT INTO inbox_items (id, project_id, task_id, agent_session_id, thread_id, payload, state, created_at, resolved_by, resolved_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
`, item.Id, item.ProjectId, item.TaskId, item.AgentSessionId, item.ThreadId,
|
||||
INSERT INTO inbox_items (id, project_id, task_id, agent_session_id, payload, state, created_at, resolved_by, resolved_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
`, item.Id, item.ProjectId, item.TaskId, item.AgentSessionId,
|
||||
string(payload), string(api.Answered), formatTime(item.CreatedAt), resp.User, now())
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -360,10 +360,10 @@ func getItem(ctx context.Context, q querier, id string) (api.InboxItem, error) {
|
||||
resolvedAt := sql.NullString{}
|
||||
|
||||
err := q.QueryRowContext(ctx, `
|
||||
SELECT id, project_id, task_id, agent_session_id, thread_id, payload, state,
|
||||
SELECT id, project_id, task_id, agent_session_id, payload, state,
|
||||
created_at, resolved_by, resolved_at
|
||||
FROM inbox_items WHERE id = ?
|
||||
`, id).Scan(&item.Id, &item.ProjectId, &item.TaskId, &item.AgentSessionId, &item.ThreadId,
|
||||
`, id).Scan(&item.Id, &item.ProjectId, &item.TaskId, &item.AgentSessionId,
|
||||
&payload, &state, &createdAt, &resolvedBy, &resolvedAt)
|
||||
if err != nil {
|
||||
return item, err
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
ALTER TABLE inbox_items DROP COLUMN thread_id;
|
||||
|
||||
UPDATE events SET payload = json_remove(payload, '$.thread_id')
|
||||
WHERE kind IN ('inbox.created', 'inbox.updated') AND json_type(payload, '$.thread_id') IS NOT NULL;
|
||||
Reference in New Issue
Block a user