Files
lcbp3/specs/200-fullstacks/230-context-aware-prompt-templates/data-model.md
T
admin 4391bbe61d
CI / CD Pipeline / build (push) Failing after 4m14s
CI / CD Pipeline / deploy (push) Has been skipped
690528:1524 ADR-030-230 context aware #02
2026-05-28 15:24:41 +07:00

1.3 KiB

Data Model Design

Feature: Context-Aware Prompt Templates & Database Typo Cleanup Created: 2026-05-27


1. Schema Modifications (ADR-009)

ตาราง ai_prompts

เพิ่มคอลัมน์ context_config เพื่อกำหนดการกรองตัวแปรอ้างอิงและตั้งค่าเฉพาะ

ALTER TABLE ai_prompts 
ADD COLUMN context_config JSON NULL 
COMMENT 'Configuration สำหรับ context ที่ backend ต้องส่งให้ AI (filter, pageSize, language, etc.)';

ตาราง correspondence_recipients

ปรับปรุงคอลัมน์ recipient_type ให้ตัดช่องว่างที่พิมพ์ผิดออกไป

ALTER TABLE correspondence_recipients
MODIFY COLUMN recipient_type ENUM('TO', 'CC') NOT NULL COMMENT 'ประเภทผู้รับ (TO หรือ CC)';

2. JSON Configurations

context_config Schema

ตัวอย่างค่าที่จะถูกจัดเก็บและประมวลผล:

{
  "filter": {
    "projectId": 1,
    "contractId": 1
  },
  "pageSize": 3,
  "language": "th",
  "outputLanguage": "th"
}