Files
amcs/schema/agent_personas.dbml
T
warkanum c179e014ad
CI / build-and-test (push) Failing after 1m52s
feat(db): add project personas and skills tables
* Introduce project_personas table with foreign keys to projects and agent_personas
* Add project_skills table with foreign key to projects and agent_skills
* Include override boolean field in agent_persona_skills and project_skills
* Update schema and migration files to reflect new tables and fields
* Enhance CORS handling to reflect request origin
2026-07-04 23:45:51 +02:00

153 lines
4.7 KiB
Plaintext

Table agent_personas {
id bigserial [pk]
guid uuid [unique, not null, default: `gen_random_uuid()`]
name text [unique, not null]
description text [not null, default: '']
summary text [not null]
detail text [not null, default: '']
compiled_summary text [not null, default: '']
compiled_detail text [not null, default: '']
compiled_at timestamptz
tags "text[]" [not null, default: `'{}'`]
created_at timestamptz [not null, default: `now()`]
updated_at timestamptz [not null, default: `now()`]
}
Table agent_parts {
id bigserial [pk]
guid uuid [unique, not null, default: `gen_random_uuid()`]
name text [unique, not null]
part_type text [not null]
description text [not null, default: '']
summary text [not null]
content text [not null, default: '']
tags "text[]" [not null, default: `'{}'`]
created_at timestamptz [not null, default: `now()`]
updated_at timestamptz [not null, default: `now()`]
}
Table agent_persona_parts {
id bigserial [pk]
persona_id bigint [not null, ref: > agent_personas.id]
part_id bigint [not null, ref: > agent_parts.id]
part_order int [not null, default: 0]
priority int [not null, default: 0]
indexes {
(persona_id, part_id) [uk]
persona_id
}
}
Table agent_persona_skills {
id bigserial [pk]
persona_id bigint [not null, ref: > agent_personas.id]
skill_id bigint [not null, ref: > agent_skills.id]
override boolean [not null, default: false]
indexes {
(persona_id, skill_id) [uk]
persona_id
}
}
Table project_personas {
id bigserial [pk]
project_id bigint [not null, ref: > projects.id]
persona_id bigint [not null, ref: > agent_personas.id]
is_default boolean [not null, default: false]
created_at timestamptz [not null, default: `now()`]
indexes {
(project_id, persona_id) [uk]
project_id
}
}
Table agent_persona_guardrails {
id bigserial [pk]
persona_id bigint [not null, ref: > agent_personas.id]
guardrail_id bigint [not null, ref: > agent_guardrails.id]
indexes {
persona_id
}
}
Table agent_traits {
id bigserial [pk]
guid uuid [unique, not null, default: `gen_random_uuid()`]
name text [unique, not null]
trait_type text [not null]
description text [not null, default: '']
instruction text [not null, default: '']
tags "text[]" [not null, default: `'{}'`]
created_at timestamptz [not null, default: `now()`]
updated_at timestamptz [not null, default: `now()`]
}
Table agent_persona_traits {
id bigserial [pk]
persona_id bigint [not null, ref: > agent_personas.id]
trait_id bigint [not null, ref: > agent_traits.id]
indexes {
persona_id
}
}
Table character_arcs {
id bigserial [pk]
name text [unique, not null]
description text [not null, default: '']
summary text [not null, default: '']
created_at timestamptz [not null, default: `now()`]
updated_at timestamptz [not null, default: `now()`]
}
Table arc_stages {
id bigserial [pk]
arc_id bigint [not null, ref: > character_arcs.id]
name text [not null]
stage_order int [not null, default: 0]
description text [not null, default: '']
condition text [not null, default: '']
created_at timestamptz [not null, default: `now()`]
}
Table arc_stage_parts {
id bigserial [pk]
stage_id bigint [not null, ref: > arc_stages.id]
part_id bigint [not null, ref: > agent_parts.id]
indexes {
(stage_id, part_id)
}
}
Table persona_arc {
id bigserial [pk]
persona_id bigint [pk, ref: > agent_personas.id]
arc_id bigint [not null, ref: > character_arcs.id]
current_stage_id bigint [not null, ref: > arc_stages.id]
updated_at timestamptz [not null, default: `now()`]
}
// Cross-file refs (for relspecgo merge)
Ref: agent_persona_parts.persona_id > agent_personas.id [delete: cascade]
Ref: agent_persona_parts.part_id > agent_parts.id [delete: cascade]
Ref: agent_persona_skills.persona_id > agent_personas.id [delete: cascade]
Ref: agent_persona_skills.skill_id > agent_skills.id [delete: cascade]
Ref: project_personas.project_id > projects.id [delete: cascade]
Ref: project_personas.persona_id > agent_personas.id [delete: cascade]
Ref: agent_persona_guardrails.persona_id > agent_personas.id [delete: cascade]
Ref: agent_persona_guardrails.guardrail_id > agent_guardrails.id [delete: cascade]
Ref: agent_persona_traits.persona_id > agent_personas.id [delete: cascade]
Ref: agent_persona_traits.trait_id > agent_traits.id [delete: cascade]
Ref: arc_stages.arc_id > character_arcs.id [delete: cascade]
Ref: arc_stage_parts.stage_id > arc_stages.id [delete: cascade]
Ref: arc_stage_parts.part_id > agent_parts.id [delete: cascade]
Ref: persona_arc.persona_id > agent_personas.id [delete: cascade]
Ref: persona_arc.arc_id > character_arcs.id
Ref: persona_arc.current_stage_id > arc_stages.id