Files
amcs/schema/plans.dbml
Hein 65715f7ad3
Some checks failed
CI / build-and-test (push) Failing after -31m35s
fix: remove redundant code in processing logic
2026-04-30 16:04:04 +02:00

93 lines
2.6 KiB
Plaintext

Table plans {
id uuid [pk, 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]
owner text
due_date timestamptz
completed_at timestamptz
reviewed_by text
last_reviewed_at timestamptz
supersedes_plan_id uuid [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 serial [pk]
plan_id uuid [not null, ref: > plans.id]
depends_on_plan_id uuid [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 serial [pk]
plan_a_id uuid [not null, ref: > plans.id]
plan_b_id uuid [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 serial [pk]
plan_id uuid [not null, ref: > plans.id]
skill_id uuid [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 serial [pk]
plan_id uuid [not null, ref: > plans.id]
guardrail_id uuid [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.guid [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]