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:
@@ -217,7 +217,8 @@ type ContactHistory struct {
|
||||
// Agent Skills & Guardrails
|
||||
|
||||
type AgentSkill struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
GUID uuid.UUID `json:"guid"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Content string `json:"content"`
|
||||
@@ -227,7 +228,8 @@ type AgentSkill struct {
|
||||
}
|
||||
|
||||
type AgentGuardrail struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
GUID uuid.UUID `json:"guid"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Content string `json:"content"`
|
||||
@@ -245,12 +247,13 @@ type ChatMessage struct {
|
||||
}
|
||||
|
||||
type ChatHistory struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
GUID uuid.UUID `json:"guid"`
|
||||
SessionID string `json:"session_id"`
|
||||
Title string `json:"title,omitempty"`
|
||||
Channel string `json:"channel,omitempty"`
|
||||
AgentID string `json:"agent_id,omitempty"`
|
||||
ProjectID *uuid.UUID `json:"project_id,omitempty"`
|
||||
ProjectID *int64 `json:"project_id,omitempty"`
|
||||
Messages []ChatMessage `json:"messages"`
|
||||
Summary string `json:"summary,omitempty"`
|
||||
Metadata map[string]any `json:"metadata"`
|
||||
|
||||
@@ -33,7 +33,8 @@ const (
|
||||
)
|
||||
|
||||
type Learning struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
GUID uuid.UUID `json:"guid"`
|
||||
Summary string `json:"summary"`
|
||||
Details string `json:"details"`
|
||||
Category string `json:"category"`
|
||||
@@ -44,13 +45,13 @@ type Learning struct {
|
||||
ActionRequired bool `json:"action_required"`
|
||||
SourceType string `json:"source_type,omitempty"`
|
||||
SourceRef string `json:"source_ref,omitempty"`
|
||||
ProjectID *uuid.UUID `json:"project_id,omitempty"`
|
||||
RelatedThoughtID *uuid.UUID `json:"related_thought_id,omitempty"`
|
||||
RelatedSkillID *uuid.UUID `json:"related_skill_id,omitempty"`
|
||||
ProjectID *int64 `json:"project_id,omitempty"`
|
||||
RelatedThoughtID *int64 `json:"related_thought_id,omitempty"`
|
||||
RelatedSkillID *int64 `json:"related_skill_id,omitempty"`
|
||||
ReviewedBy *string `json:"reviewed_by,omitempty"`
|
||||
ReviewedAt *time.Time `json:"reviewed_at,omitempty"`
|
||||
DuplicateOfLearningID *uuid.UUID `json:"duplicate_of_learning_id,omitempty"`
|
||||
SupersedesLearningID *uuid.UUID `json:"supersedes_learning_id,omitempty"`
|
||||
DuplicateOfLearningID *int64 `json:"duplicate_of_learning_id,omitempty"`
|
||||
SupersedesLearningID *int64 `json:"supersedes_learning_id,omitempty"`
|
||||
Tags []string `json:"tags"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
@@ -58,7 +59,7 @@ type Learning struct {
|
||||
|
||||
type LearningFilter struct {
|
||||
Limit int
|
||||
ProjectID *uuid.UUID
|
||||
ProjectID *int64
|
||||
Category string
|
||||
Area string
|
||||
Status string
|
||||
|
||||
@@ -27,18 +27,19 @@ const (
|
||||
)
|
||||
|
||||
type Plan struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
GUID uuid.UUID `json:"guid"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Status PlanStatus `json:"status"`
|
||||
Priority PlanPriority `json:"priority"`
|
||||
ProjectID *uuid.UUID `json:"project_id,omitempty"`
|
||||
ProjectID *int64 `json:"project_id,omitempty"`
|
||||
Owner string `json:"owner,omitempty"`
|
||||
DueDate *time.Time `json:"due_date,omitempty"`
|
||||
CompletedAt *time.Time `json:"completed_at,omitempty"`
|
||||
ReviewedBy string `json:"reviewed_by,omitempty"`
|
||||
LastReviewedAt *time.Time `json:"last_reviewed_at,omitempty"`
|
||||
SupersedesPlanID *uuid.UUID `json:"supersedes_plan_id,omitempty"`
|
||||
SupersedesPlanID *int64 `json:"supersedes_plan_id,omitempty"`
|
||||
Tags []string `json:"tags"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
@@ -56,7 +57,7 @@ type PlanDetail struct {
|
||||
|
||||
type PlanFilter struct {
|
||||
Limit int
|
||||
ProjectID *uuid.UUID
|
||||
ProjectID *int64
|
||||
Status string
|
||||
Priority string
|
||||
Owner string
|
||||
@@ -77,7 +78,7 @@ type PlanUpdate struct {
|
||||
ClearCompletedAt bool
|
||||
ReviewedBy *string // "" to clear
|
||||
MarkReviewed bool // sets last_reviewed_at = now()
|
||||
SupersedesPlanID *uuid.UUID
|
||||
SupersedesPlanID *int64
|
||||
ClearSupersedesPlanID bool
|
||||
Tags *[]string // nil = no change; replace when non-nil
|
||||
}
|
||||
|
||||
@@ -9,11 +9,12 @@ import (
|
||||
type ThoughtPatch struct {
|
||||
Content *string `json:"content,omitempty"`
|
||||
Metadata ThoughtMetadata `json:"metadata,omitempty"`
|
||||
Project *uuid.UUID `json:"project_id,omitempty"`
|
||||
Project *int64 `json:"project_id,omitempty"`
|
||||
}
|
||||
|
||||
type Project struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
NumericID int64 `json:"-"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
|
||||
@@ -30,9 +30,10 @@ type ThoughtAttachment struct {
|
||||
}
|
||||
|
||||
type StoredFile struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
ThoughtID *uuid.UUID `json:"thought_id,omitempty"`
|
||||
ProjectID *uuid.UUID `json:"project_id,omitempty"`
|
||||
ID int64 `json:"id"`
|
||||
GUID uuid.UUID `json:"guid"`
|
||||
ThoughtID *int64 `json:"thought_id,omitempty"`
|
||||
ProjectID *int64 `json:"project_id,omitempty"`
|
||||
Name string `json:"name"`
|
||||
MediaType string `json:"media_type"`
|
||||
Kind string `json:"kind"`
|
||||
@@ -46,25 +47,26 @@ type StoredFile struct {
|
||||
|
||||
type StoredFileFilter struct {
|
||||
Limit int
|
||||
ThoughtID *uuid.UUID
|
||||
ProjectID *uuid.UUID
|
||||
ThoughtID *int64
|
||||
ProjectID *int64
|
||||
Kind string
|
||||
}
|
||||
|
||||
type Thought struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
GUID uuid.UUID `json:"guid"`
|
||||
Content string `json:"content"`
|
||||
Embedding []float32 `json:"embedding,omitempty"`
|
||||
EmbeddingStatus string `json:"embedding_status,omitempty"`
|
||||
Metadata ThoughtMetadata `json:"metadata"`
|
||||
ProjectID *uuid.UUID `json:"project_id,omitempty"`
|
||||
ProjectID *int64 `json:"project_id,omitempty"`
|
||||
ArchivedAt *time.Time `json:"archived_at,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type SearchResult struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
ID int64 `json:"id"`
|
||||
Content string `json:"content"`
|
||||
Metadata ThoughtMetadata `json:"metadata"`
|
||||
Similarity float64 `json:"similarity"`
|
||||
@@ -77,7 +79,7 @@ type ListFilter struct {
|
||||
Topic string
|
||||
Person string
|
||||
Days int
|
||||
ProjectID *uuid.UUID
|
||||
ProjectID *int64
|
||||
IncludeArchived bool
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user