refactor(store,tools): migrate IDs from UUID to bigserial int64
Some checks failed
CI / build-and-test (push) Failing after -31m12s
Some checks failed
CI / build-and-test (push) Failing after -31m12s
All internal entity lookups now use bigserial primary keys (int64) while GUIDs are retained for external/public identification. Updated store functions (TouchProject, UpdateThoughtMetadata, AddThoughtAttachment) to query by id instead of guid, added GetThoughtByID, changed semanticSearch and all tool helpers to use *int64 project IDs, and updated retry/backfill workers to use int64 thought IDs throughout.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
Table chat_histories {
|
||||
id uuid [pk, default: `gen_random_uuid()`]
|
||||
id bigserial [pk]
|
||||
guid uuid [unique, not null, default: `gen_random_uuid()`]
|
||||
session_id text [not null]
|
||||
title text
|
||||
channel text
|
||||
agent_id text
|
||||
project_id uuid [ref: > projects.guid]
|
||||
project_id bigint [ref: > projects.id]
|
||||
messages jsonb [not null, default: `'[]'`]
|
||||
summary text
|
||||
metadata jsonb [not null, default: `'{}'`]
|
||||
@@ -29,10 +30,11 @@ Table tool_annotations {
|
||||
}
|
||||
|
||||
// Cross-file refs (for relspecgo merge)
|
||||
Ref: chat_histories.project_id > projects.guid [delete: set null]
|
||||
Ref: chat_histories.project_id > projects.id [delete: set null]
|
||||
|
||||
Table learnings {
|
||||
id uuid [pk, default: `gen_random_uuid()`]
|
||||
id bigserial [pk]
|
||||
guid uuid [unique, not null, default: `gen_random_uuid()`]
|
||||
summary text [not null]
|
||||
details text [not null, default: '']
|
||||
category text [not null, default: 'insight']
|
||||
@@ -43,13 +45,13 @@ Table learnings {
|
||||
action_required boolean [not null, default: false]
|
||||
source_type text
|
||||
source_ref text
|
||||
project_id uuid [ref: > projects.guid]
|
||||
related_thought_id uuid [ref: > thoughts.guid]
|
||||
related_skill_id uuid [ref: > agent_skills.id]
|
||||
project_id bigint [ref: > projects.id]
|
||||
related_thought_id bigint [ref: > thoughts.id]
|
||||
related_skill_id bigint [ref: > agent_skills.id]
|
||||
reviewed_by text
|
||||
reviewed_at timestamptz
|
||||
duplicate_of_learning_id uuid [ref: > learnings.id]
|
||||
supersedes_learning_id uuid [ref: > learnings.id]
|
||||
duplicate_of_learning_id bigint [ref: > learnings.id]
|
||||
supersedes_learning_id bigint [ref: > learnings.id]
|
||||
tags "text[]" [not null, default: `'{}'`]
|
||||
created_at timestamptz [not null, default: `now()`]
|
||||
updated_at timestamptz [not null, default: `now()`]
|
||||
@@ -68,8 +70,8 @@ Table learnings {
|
||||
}
|
||||
|
||||
// Cross-file refs (for relspecgo merge)
|
||||
Ref: learnings.project_id > projects.guid [delete: set null]
|
||||
Ref: learnings.related_thought_id > thoughts.guid [delete: set null]
|
||||
Ref: learnings.project_id > projects.id [delete: set null]
|
||||
Ref: learnings.related_thought_id > thoughts.id [delete: set null]
|
||||
Ref: learnings.related_skill_id > agent_skills.id [delete: set null]
|
||||
Ref: learnings.duplicate_of_learning_id > learnings.id [delete: set null]
|
||||
Ref: learnings.supersedes_learning_id > learnings.id [delete: set null]
|
||||
|
||||
Reference in New Issue
Block a user