refactor(store,tools): migrate IDs from UUID to bigserial int64
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:
2026-05-03 11:43:34 +02:00
parent 9e6d05e055
commit 91239bcf4b
58 changed files with 1208 additions and 2774 deletions

View File

@@ -1,16 +1,17 @@
Table plans {
id uuid [pk, default: `gen_random_uuid()`]
id bigserial [pk]
guid uuid [unique, not null, default: `gen_random_uuid()`]
title text [not null]
description text [not null, default: '']
status text [not null, default: 'draft'] // draft, active, blocked, completed, cancelled, superseded
priority text [not null, default: 'medium'] // low, medium, high, critical
project_id uuid [ref: > projects.guid]
project_id bigint [ref: > projects.id]
owner text
due_date timestamptz
completed_at timestamptz
reviewed_by text
last_reviewed_at timestamptz
supersedes_plan_id uuid [ref: > plans.id]
supersedes_plan_id bigint [ref: > plans.id]
tags "text[]" [not null, default: `'{}'`]
created_at timestamptz [not null, default: `now()`]
updated_at timestamptz [not null, default: `now()`]
@@ -29,9 +30,9 @@ Table plans {
// Directional: plan_id cannot proceed until depends_on_plan_id is complete
Table plan_dependencies {
id serial [pk]
plan_id uuid [not null, ref: > plans.id]
depends_on_plan_id uuid [not null, ref: > plans.id]
id bigserial [pk]
plan_id bigint [not null, ref: > plans.id]
depends_on_plan_id bigint [not null, ref: > plans.id]
created_at timestamptz [not null, default: `now()`]
indexes {
@@ -43,9 +44,9 @@ Table plan_dependencies {
// Bidirectional: store with plan_a_id < plan_b_id to avoid duplicates
Table plan_related_plans {
id serial [pk]
plan_a_id uuid [not null, ref: > plans.id]
plan_b_id uuid [not null, ref: > plans.id]
id bigserial [pk]
plan_a_id bigint [not null, ref: > plans.id]
plan_b_id bigint [not null, ref: > plans.id]
created_at timestamptz [not null, default: `now()`]
indexes {
@@ -56,9 +57,9 @@ Table plan_related_plans {
}
Table plan_skills {
id serial [pk]
plan_id uuid [not null, ref: > plans.id]
skill_id uuid [not null, ref: > agent_skills.id]
id bigserial [pk]
plan_id bigint [not null, ref: > plans.id]
skill_id bigint [not null, ref: > agent_skills.id]
created_at timestamptz [not null, default: `now()`]
indexes {
@@ -68,9 +69,9 @@ Table plan_skills {
}
Table plan_guardrails {
id serial [pk]
plan_id uuid [not null, ref: > plans.id]
guardrail_id uuid [not null, ref: > agent_guardrails.id]
id bigserial [pk]
plan_id bigint [not null, ref: > plans.id]
guardrail_id bigint [not null, ref: > agent_guardrails.id]
created_at timestamptz [not null, default: `now()`]
indexes {
@@ -80,7 +81,7 @@ Table plan_guardrails {
}
// Cross-file refs (for relspecgo merge)
Ref: plans.project_id > projects.guid [delete: set null]
Ref: plans.project_id > projects.id [delete: set null]
Ref: plans.supersedes_plan_id > plans.id [delete: set null]
Ref: plan_dependencies.plan_id > plans.id [delete: cascade]
Ref: plan_dependencies.depends_on_plan_id > plans.id [delete: cascade]