Files
amcs/schema/agent_personas.dbml
Hein a993859c62
CI / build-and-test (push) Has been cancelled
feat(db): add oauth_clients table for dynamic client registration
* Introduced oauth_clients table with fields for client_id, client_name, redirect_uris, and created_at.
* Updated agent_persona_parts, agent_persona_skills, agent_persona_guardrails, agent_persona_traits, and arc_stage_parts tables to use unique constraints instead of primary keys for composite indexes.
2026-05-07 13:30:30 +02:00

137 lines
4.2 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]
indexes {
(persona_id, skill_id) [uk]
persona_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: 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