Files
amcs/schema/plans.dbml
Hein 91239bcf4b
Some checks failed
CI / build-and-test (push) Failing after -31m12s
refactor(store,tools): migrate IDs from UUID to bigserial int64
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.
2026-05-03 11:43:34 +02:00

94 lines
2.7 KiB
Plaintext

Table plans {
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 bigint [ref: > projects.id]
owner text
due_date timestamptz
completed_at timestamptz
reviewed_by text
last_reviewed_at timestamptz
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()`]
indexes {
project_id
status
priority
owner
due_date
last_reviewed_at
tags [type: gin]
title [type: gin]
}
}
// Directional: plan_id cannot proceed until depends_on_plan_id is complete
Table plan_dependencies {
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 {
(plan_id, depends_on_plan_id) [unique]
plan_id
depends_on_plan_id
}
}
// Bidirectional: store with plan_a_id < plan_b_id to avoid duplicates
Table plan_related_plans {
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 {
(plan_a_id, plan_b_id) [unique]
plan_a_id
plan_b_id
}
}
Table plan_skills {
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 {
(plan_id, skill_id) [unique]
plan_id
}
}
Table plan_guardrails {
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 {
(plan_id, guardrail_id) [unique]
plan_id
}
}
// Cross-file refs (for relspecgo merge)
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]
Ref: plan_related_plans.plan_a_id > plans.id [delete: cascade]
Ref: plan_related_plans.plan_b_id > plans.id [delete: cascade]
Ref: plan_skills.plan_id > plans.id [delete: cascade]
Ref: plan_skills.skill_id > agent_skills.id [delete: cascade]
Ref: plan_guardrails.plan_id > plans.id [delete: cascade]
Ref: plan_guardrails.guardrail_id > agent_guardrails.id [delete: cascade]