Commit 5f9e571
committed
Add messages table for AI (bot + TMA)
Create messages table in runSchemaMigrations with id, created_at, user_telegram (FK to users), thread_id, type (bot|app), role (user|assistant|system), content, telegram_update_id (nullable). Add index for thread history (user_telegram, thread_id, type, created_at) and partial unique index for bot deduplication (user_telegram, thread_id, type, telegram_update_id) where telegram_update_id IS NOT NULL. Implements plan in app/database/plan.md.
Made-with: Cursor1 parent d3b223c commit 5f9e571
1 file changed
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
82 | 107 | | |
83 | 108 | | |
84 | 109 | | |
| |||
0 commit comments