team-anya-cli 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packages/db/src/migrations/{0000_simple_magneto.sql → 0000_baseline.sql} +158 -55
- package/packages/db/src/migrations/meta/_journal.json +3 -52
- package/packages/db/src/migrations/0001_nifty_morph.sql +0 -42
- package/packages/db/src/migrations/0002_common_joshua_kane.sql +0 -20
- package/packages/db/src/migrations/0003_add_cc_sessions.sql +0 -13
- package/packages/db/src/migrations/0004_jittery_triathlon.sql +0 -1
- package/packages/db/src/migrations/0005_lethal_golden_guardian.sql +0 -5
- package/packages/db/src/migrations/0006_add_topics.sql +0 -21
- package/packages/db/src/migrations/0007_add_topic_root_message_id.sql +0 -1
- package/packages/db/src/migrations/meta/0000_snapshot.json +0 -987
- package/packages/db/src/migrations/meta/0001_snapshot.json +0 -1280
- package/packages/db/src/migrations/meta/0002_snapshot.json +0 -1417
- package/packages/db/src/migrations/meta/0004_snapshot.json +0 -1505
- package/packages/db/src/migrations/meta/0005_snapshot.json +0 -1513
- package/packages/db/src/migrations/meta/0006_snapshot.json +0 -1513
package/package.json
CHANGED
|
@@ -1,56 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
`event_type` text NOT NULL,
|
|
4
|
-
`actor` text NOT NULL,
|
|
5
|
-
`task_id` text,
|
|
6
|
-
`summary` text NOT NULL,
|
|
7
|
-
`detail` text,
|
|
8
|
-
`file_ref` text,
|
|
9
|
-
`created_at` text DEFAULT (datetime('now')) NOT NULL
|
|
10
|
-
);
|
|
11
|
-
--> statement-breakpoint
|
|
12
|
-
CREATE TABLE `commitments` (
|
|
13
|
-
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
14
|
-
`task_id` text NOT NULL,
|
|
15
|
-
`promised_to` text NOT NULL,
|
|
16
|
-
`promise` text NOT NULL,
|
|
17
|
-
`deadline` text,
|
|
18
|
-
`status` text DEFAULT 'active' NOT NULL,
|
|
19
|
-
`break_reason` text,
|
|
20
|
-
`promised_at` text DEFAULT (datetime('now')) NOT NULL,
|
|
21
|
-
FOREIGN KEY (`task_id`) REFERENCES `tasks`(`task_id`) ON UPDATE no action ON DELETE no action
|
|
22
|
-
);
|
|
23
|
-
--> statement-breakpoint
|
|
24
|
-
CREATE TABLE `communication_events` (
|
|
25
|
-
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
26
|
-
`source_type` text NOT NULL,
|
|
27
|
-
`source_ref` text,
|
|
28
|
-
`intent_level` integer NOT NULL,
|
|
29
|
-
`sender` text,
|
|
30
|
-
`summary` text NOT NULL,
|
|
31
|
-
`raw_content_path` text,
|
|
32
|
-
`opportunity_id` text,
|
|
33
|
-
`created_at` text DEFAULT (datetime('now')) NOT NULL
|
|
34
|
-
);
|
|
35
|
-
--> statement-breakpoint
|
|
36
|
-
CREATE TABLE `task_clarifications` (
|
|
37
|
-
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
38
|
-
`task_id` text NOT NULL,
|
|
39
|
-
`question` text NOT NULL,
|
|
40
|
-
`answer` text,
|
|
41
|
-
`asked_by` text DEFAULT 'loid' NOT NULL,
|
|
42
|
-
`answered_by` text,
|
|
43
|
-
`asked_at` text DEFAULT (datetime('now')) NOT NULL,
|
|
44
|
-
`answered_at` text,
|
|
45
|
-
FOREIGN KEY (`task_id`) REFERENCES `tasks`(`task_id`) ON UPDATE no action ON DELETE no action
|
|
46
|
-
);
|
|
47
|
-
--> statement-breakpoint
|
|
1
|
+
-- Baseline: squash of migrations 0000-0007
|
|
2
|
+
-- Generated: 2026-02-26
|
|
48
3
|
CREATE TABLE `tasks` (
|
|
49
4
|
`task_id` text PRIMARY KEY NOT NULL,
|
|
50
5
|
`title` text NOT NULL,
|
|
51
6
|
`status` text DEFAULT 'NEW' NOT NULL,
|
|
52
7
|
`source_type` text NOT NULL,
|
|
53
8
|
`source_ref` text,
|
|
9
|
+
`created_by` text,
|
|
10
|
+
`source_chat_id` text,
|
|
54
11
|
`objective` text,
|
|
55
12
|
`acceptance_criteria` text,
|
|
56
13
|
`context` text,
|
|
@@ -63,11 +20,37 @@ CREATE TABLE `tasks` (
|
|
|
63
20
|
`blocked_reason` text,
|
|
64
21
|
`blocked_since` text,
|
|
65
22
|
`execution_guidance` text,
|
|
23
|
+
`cc_session_id` text,
|
|
66
24
|
`workspace_path` text,
|
|
25
|
+
`topic_id` text REFERENCES `topics`(`id`),
|
|
67
26
|
`created_at` text DEFAULT (datetime('now')) NOT NULL,
|
|
68
27
|
`updated_at` text DEFAULT (datetime('now')) NOT NULL
|
|
69
28
|
);
|
|
70
29
|
--> statement-breakpoint
|
|
30
|
+
CREATE TABLE `task_clarifications` (
|
|
31
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
32
|
+
`task_id` text NOT NULL,
|
|
33
|
+
`question` text NOT NULL,
|
|
34
|
+
`answer` text,
|
|
35
|
+
`asked_by` text DEFAULT 'loid' NOT NULL,
|
|
36
|
+
`answered_by` text,
|
|
37
|
+
`asked_at` text DEFAULT (datetime('now')) NOT NULL,
|
|
38
|
+
`answered_at` text,
|
|
39
|
+
FOREIGN KEY (`task_id`) REFERENCES `tasks`(`task_id`) ON UPDATE no action ON DELETE no action
|
|
40
|
+
);
|
|
41
|
+
--> statement-breakpoint
|
|
42
|
+
CREATE TABLE `commitments` (
|
|
43
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
44
|
+
`task_id` text NOT NULL,
|
|
45
|
+
`promised_to` text NOT NULL,
|
|
46
|
+
`promise` text NOT NULL,
|
|
47
|
+
`deadline` text,
|
|
48
|
+
`status` text DEFAULT 'active' NOT NULL,
|
|
49
|
+
`break_reason` text,
|
|
50
|
+
`promised_at` text DEFAULT (datetime('now')) NOT NULL,
|
|
51
|
+
FOREIGN KEY (`task_id`) REFERENCES `tasks`(`task_id`) ON UPDATE no action ON DELETE no action
|
|
52
|
+
);
|
|
53
|
+
--> statement-breakpoint
|
|
71
54
|
CREATE TABLE `opportunities` (
|
|
72
55
|
`id` text PRIMARY KEY NOT NULL,
|
|
73
56
|
`status` text DEFAULT 'detected' NOT NULL,
|
|
@@ -84,6 +67,29 @@ CREATE TABLE `opportunities` (
|
|
|
84
67
|
FOREIGN KEY (`converted_task_id`) REFERENCES `tasks`(`task_id`) ON UPDATE no action ON DELETE no action
|
|
85
68
|
);
|
|
86
69
|
--> statement-breakpoint
|
|
70
|
+
CREATE TABLE `audit_events` (
|
|
71
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
72
|
+
`event_type` text NOT NULL,
|
|
73
|
+
`actor` text NOT NULL,
|
|
74
|
+
`task_id` text,
|
|
75
|
+
`summary` text NOT NULL,
|
|
76
|
+
`detail` text,
|
|
77
|
+
`file_ref` text,
|
|
78
|
+
`created_at` text DEFAULT (datetime('now')) NOT NULL
|
|
79
|
+
);
|
|
80
|
+
--> statement-breakpoint
|
|
81
|
+
CREATE TABLE `communication_events` (
|
|
82
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
83
|
+
`source_type` text NOT NULL,
|
|
84
|
+
`source_ref` text,
|
|
85
|
+
`intent_level` integer NOT NULL,
|
|
86
|
+
`sender` text,
|
|
87
|
+
`summary` text NOT NULL,
|
|
88
|
+
`raw_content_path` text,
|
|
89
|
+
`opportunity_id` text,
|
|
90
|
+
`created_at` text DEFAULT (datetime('now')) NOT NULL
|
|
91
|
+
);
|
|
92
|
+
--> statement-breakpoint
|
|
87
93
|
CREATE TABLE `message_log` (
|
|
88
94
|
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
89
95
|
`direction` text NOT NULL,
|
|
@@ -102,14 +108,6 @@ CREATE TABLE `message_log` (
|
|
|
102
108
|
`created_at` text DEFAULT (datetime('now')) NOT NULL
|
|
103
109
|
);
|
|
104
110
|
--> statement-breakpoint
|
|
105
|
-
CREATE TABLE `org_escalation_rules` (
|
|
106
|
-
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
107
|
-
`scope` text DEFAULT 'global' NOT NULL,
|
|
108
|
-
`after_minutes` integer NOT NULL,
|
|
109
|
-
`action` text NOT NULL,
|
|
110
|
-
`targets` text NOT NULL
|
|
111
|
-
);
|
|
112
|
-
--> statement-breakpoint
|
|
113
111
|
CREATE TABLE `org_members` (
|
|
114
112
|
`member_id` text PRIMARY KEY NOT NULL,
|
|
115
113
|
`name` text NOT NULL,
|
|
@@ -118,6 +116,15 @@ CREATE TABLE `org_members` (
|
|
|
118
116
|
`timezone` text,
|
|
119
117
|
`profile_path` text,
|
|
120
118
|
`response_pattern` text,
|
|
119
|
+
`platform` text DEFAULT 'feishu',
|
|
120
|
+
`union_id` text,
|
|
121
|
+
`user_id` text,
|
|
122
|
+
`en_name` text,
|
|
123
|
+
`email` text,
|
|
124
|
+
`employee_no` text,
|
|
125
|
+
`avatar_url` text,
|
|
126
|
+
`metadata` text,
|
|
127
|
+
`last_synced_at` text,
|
|
121
128
|
`updated_at` text DEFAULT (datetime('now')) NOT NULL
|
|
122
129
|
);
|
|
123
130
|
--> statement-breakpoint
|
|
@@ -130,6 +137,14 @@ CREATE TABLE `org_ownership` (
|
|
|
130
137
|
FOREIGN KEY (`member_id`) REFERENCES `org_members`(`member_id`) ON UPDATE no action ON DELETE no action
|
|
131
138
|
);
|
|
132
139
|
--> statement-breakpoint
|
|
140
|
+
CREATE TABLE `org_escalation_rules` (
|
|
141
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
142
|
+
`scope` text DEFAULT 'global' NOT NULL,
|
|
143
|
+
`after_minutes` integer NOT NULL,
|
|
144
|
+
`action` text NOT NULL,
|
|
145
|
+
`targets` text NOT NULL
|
|
146
|
+
);
|
|
147
|
+
--> statement-breakpoint
|
|
133
148
|
CREATE TABLE `trace_spans` (
|
|
134
149
|
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
135
150
|
`trace_id` text NOT NULL,
|
|
@@ -146,3 +161,91 @@ CREATE TABLE `trace_spans` (
|
|
|
146
161
|
`metadata` text,
|
|
147
162
|
`created_at` text DEFAULT (datetime('now')) NOT NULL
|
|
148
163
|
);
|
|
164
|
+
--> statement-breakpoint
|
|
165
|
+
CREATE TABLE `chats` (
|
|
166
|
+
`chat_id` text PRIMARY KEY NOT NULL,
|
|
167
|
+
`platform` text DEFAULT 'feishu' NOT NULL,
|
|
168
|
+
`name` text,
|
|
169
|
+
`description` text,
|
|
170
|
+
`avatar` text,
|
|
171
|
+
`owner_id` text,
|
|
172
|
+
`chat_mode` text,
|
|
173
|
+
`chat_type` text,
|
|
174
|
+
`chat_tag` text,
|
|
175
|
+
`chat_status` text DEFAULT 'normal',
|
|
176
|
+
`external` integer DEFAULT 0,
|
|
177
|
+
`tenant_key` text,
|
|
178
|
+
`user_count` integer,
|
|
179
|
+
`bot_count` integer,
|
|
180
|
+
`metadata` text,
|
|
181
|
+
`first_seen_at` text DEFAULT (datetime('now')) NOT NULL,
|
|
182
|
+
`last_synced_at` text,
|
|
183
|
+
`updated_at` text DEFAULT (datetime('now')) NOT NULL
|
|
184
|
+
);
|
|
185
|
+
--> statement-breakpoint
|
|
186
|
+
CREATE TABLE `chat_members` (
|
|
187
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
188
|
+
`chat_id` text NOT NULL,
|
|
189
|
+
`member_id` text NOT NULL,
|
|
190
|
+
`role` text DEFAULT 'member',
|
|
191
|
+
`synced_at` text DEFAULT (datetime('now')) NOT NULL,
|
|
192
|
+
FOREIGN KEY (`chat_id`) REFERENCES `chats`(`chat_id`) ON UPDATE no action ON DELETE no action,
|
|
193
|
+
FOREIGN KEY (`member_id`) REFERENCES `org_members`(`member_id`) ON UPDATE no action ON DELETE no action
|
|
194
|
+
);
|
|
195
|
+
--> statement-breakpoint
|
|
196
|
+
CREATE TABLE `projects` (
|
|
197
|
+
`project_id` text PRIMARY KEY NOT NULL,
|
|
198
|
+
`name` text NOT NULL,
|
|
199
|
+
`description` text,
|
|
200
|
+
`platform` text DEFAULT 'github',
|
|
201
|
+
`claude_md` text,
|
|
202
|
+
`deleted_at` text,
|
|
203
|
+
`created_at` text DEFAULT (datetime('now')) NOT NULL,
|
|
204
|
+
`updated_at` text DEFAULT (datetime('now')) NOT NULL
|
|
205
|
+
);
|
|
206
|
+
--> statement-breakpoint
|
|
207
|
+
CREATE TABLE `project_repos` (
|
|
208
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
209
|
+
`project_id` text NOT NULL,
|
|
210
|
+
`name` text NOT NULL,
|
|
211
|
+
`git_url` text,
|
|
212
|
+
`repo_path` text,
|
|
213
|
+
`default_branch` text DEFAULT 'main',
|
|
214
|
+
`created_at` text DEFAULT (datetime('now')) NOT NULL,
|
|
215
|
+
FOREIGN KEY (`project_id`) REFERENCES `projects`(`project_id`) ON UPDATE no action ON DELETE no action
|
|
216
|
+
);
|
|
217
|
+
--> statement-breakpoint
|
|
218
|
+
CREATE TABLE `cc_sessions` (
|
|
219
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
220
|
+
`session_id` text NOT NULL,
|
|
221
|
+
`role` text NOT NULL,
|
|
222
|
+
`instance_id` text,
|
|
223
|
+
`task_id` text,
|
|
224
|
+
`chat_id` text,
|
|
225
|
+
`project_path` text,
|
|
226
|
+
`started_at` text DEFAULT (datetime('now')) NOT NULL,
|
|
227
|
+
`ended_at` text
|
|
228
|
+
);
|
|
229
|
+
--> statement-breakpoint
|
|
230
|
+
CREATE UNIQUE INDEX `cc_sessions_session_id_unique` ON `cc_sessions` (`session_id`);
|
|
231
|
+
--> statement-breakpoint
|
|
232
|
+
CREATE TABLE `topics` (
|
|
233
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
234
|
+
`project_id` text REFERENCES `projects`(`project_id`),
|
|
235
|
+
`title` text NOT NULL,
|
|
236
|
+
`description` text,
|
|
237
|
+
`status` text NOT NULL DEFAULT 'active',
|
|
238
|
+
`thread_id` text,
|
|
239
|
+
`root_message_id` text,
|
|
240
|
+
`chat_id` text,
|
|
241
|
+
`workspace_path` text,
|
|
242
|
+
`branch_name` text,
|
|
243
|
+
`created_by` text,
|
|
244
|
+
`created_at` text NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
|
|
245
|
+
`updated_at` text NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
|
|
246
|
+
`closed_at` text
|
|
247
|
+
);
|
|
248
|
+
--> statement-breakpoint
|
|
249
|
+
CREATE INDEX `idx_topics_thread_id` ON `topics` (`thread_id`);
|
|
250
|
+
--> statement-breakpoint
|
|
251
|
+
CREATE INDEX `idx_topics_status` ON `topics` (`status`);
|
|
@@ -4,59 +4,10 @@
|
|
|
4
4
|
"entries": [
|
|
5
5
|
{
|
|
6
6
|
"idx": 0,
|
|
7
|
-
"version": "6",
|
|
8
|
-
"when": 1771231965763,
|
|
9
|
-
"tag": "0000_simple_magneto",
|
|
10
|
-
"breakpoints": true
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"idx": 1,
|
|
14
|
-
"version": "6",
|
|
15
|
-
"when": 1771898136519,
|
|
16
|
-
"tag": "0001_nifty_morph",
|
|
17
|
-
"breakpoints": true
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"idx": 2,
|
|
21
|
-
"version": "6",
|
|
22
|
-
"when": 1771903810417,
|
|
23
|
-
"tag": "0002_common_joshua_kane",
|
|
24
|
-
"breakpoints": true
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"idx": 3,
|
|
28
|
-
"version": "6",
|
|
29
|
-
"when": 1772006400000,
|
|
30
|
-
"tag": "0003_add_cc_sessions",
|
|
31
|
-
"breakpoints": true
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"idx": 4,
|
|
35
|
-
"version": "6",
|
|
36
|
-
"when": 1771937237299,
|
|
37
|
-
"tag": "0004_jittery_triathlon",
|
|
38
|
-
"breakpoints": true
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"idx": 5,
|
|
42
|
-
"version": "6",
|
|
43
|
-
"when": 1772013330955,
|
|
44
|
-
"tag": "0005_lethal_golden_guardian",
|
|
45
|
-
"breakpoints": true
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"idx": 6,
|
|
49
|
-
"version": "7",
|
|
50
|
-
"when": 1772013331000,
|
|
51
|
-
"tag": "0006_add_topics",
|
|
52
|
-
"breakpoints": true
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"idx": 7,
|
|
56
7
|
"version": "7",
|
|
57
|
-
"when":
|
|
58
|
-
"tag": "
|
|
8
|
+
"when": 1772100000000,
|
|
9
|
+
"tag": "0000_baseline",
|
|
59
10
|
"breakpoints": true
|
|
60
11
|
}
|
|
61
12
|
]
|
|
62
|
-
}
|
|
13
|
+
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
CREATE TABLE `chat_members` (
|
|
2
|
-
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
3
|
-
`chat_id` text NOT NULL,
|
|
4
|
-
`member_id` text NOT NULL,
|
|
5
|
-
`role` text DEFAULT 'member',
|
|
6
|
-
`synced_at` text DEFAULT (datetime('now')) NOT NULL,
|
|
7
|
-
FOREIGN KEY (`chat_id`) REFERENCES `chats`(`chat_id`) ON UPDATE no action ON DELETE no action,
|
|
8
|
-
FOREIGN KEY (`member_id`) REFERENCES `org_members`(`member_id`) ON UPDATE no action ON DELETE no action
|
|
9
|
-
);
|
|
10
|
-
--> statement-breakpoint
|
|
11
|
-
CREATE TABLE `chats` (
|
|
12
|
-
`chat_id` text PRIMARY KEY NOT NULL,
|
|
13
|
-
`platform` text DEFAULT 'feishu' NOT NULL,
|
|
14
|
-
`name` text,
|
|
15
|
-
`description` text,
|
|
16
|
-
`avatar` text,
|
|
17
|
-
`owner_id` text,
|
|
18
|
-
`chat_mode` text,
|
|
19
|
-
`chat_type` text,
|
|
20
|
-
`chat_tag` text,
|
|
21
|
-
`chat_status` text DEFAULT 'normal',
|
|
22
|
-
`external` integer DEFAULT 0,
|
|
23
|
-
`tenant_key` text,
|
|
24
|
-
`user_count` integer,
|
|
25
|
-
`bot_count` integer,
|
|
26
|
-
`metadata` text,
|
|
27
|
-
`first_seen_at` text DEFAULT (datetime('now')) NOT NULL,
|
|
28
|
-
`last_synced_at` text,
|
|
29
|
-
`updated_at` text DEFAULT (datetime('now')) NOT NULL
|
|
30
|
-
);
|
|
31
|
-
--> statement-breakpoint
|
|
32
|
-
ALTER TABLE `tasks` ADD `created_by` text;--> statement-breakpoint
|
|
33
|
-
ALTER TABLE `tasks` ADD `source_chat_id` text;--> statement-breakpoint
|
|
34
|
-
ALTER TABLE `org_members` ADD `platform` text DEFAULT 'feishu';--> statement-breakpoint
|
|
35
|
-
ALTER TABLE `org_members` ADD `union_id` text;--> statement-breakpoint
|
|
36
|
-
ALTER TABLE `org_members` ADD `user_id` text;--> statement-breakpoint
|
|
37
|
-
ALTER TABLE `org_members` ADD `en_name` text;--> statement-breakpoint
|
|
38
|
-
ALTER TABLE `org_members` ADD `email` text;--> statement-breakpoint
|
|
39
|
-
ALTER TABLE `org_members` ADD `employee_no` text;--> statement-breakpoint
|
|
40
|
-
ALTER TABLE `org_members` ADD `avatar_url` text;--> statement-breakpoint
|
|
41
|
-
ALTER TABLE `org_members` ADD `metadata` text;--> statement-breakpoint
|
|
42
|
-
ALTER TABLE `org_members` ADD `last_synced_at` text;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
CREATE TABLE `project_repos` (
|
|
2
|
-
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
3
|
-
`project_id` text NOT NULL,
|
|
4
|
-
`name` text NOT NULL,
|
|
5
|
-
`git_url` text,
|
|
6
|
-
`repo_path` text,
|
|
7
|
-
`default_branch` text DEFAULT 'main',
|
|
8
|
-
`created_at` text DEFAULT (datetime('now')) NOT NULL,
|
|
9
|
-
FOREIGN KEY (`project_id`) REFERENCES `projects`(`project_id`) ON UPDATE no action ON DELETE no action
|
|
10
|
-
);
|
|
11
|
-
--> statement-breakpoint
|
|
12
|
-
CREATE TABLE `projects` (
|
|
13
|
-
`project_id` text PRIMARY KEY NOT NULL,
|
|
14
|
-
`name` text NOT NULL,
|
|
15
|
-
`description` text,
|
|
16
|
-
`platform` text DEFAULT 'github',
|
|
17
|
-
`claude_md` text,
|
|
18
|
-
`created_at` text DEFAULT (datetime('now')) NOT NULL,
|
|
19
|
-
`updated_at` text DEFAULT (datetime('now')) NOT NULL
|
|
20
|
-
);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
CREATE TABLE `cc_sessions` (
|
|
2
|
-
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
3
|
-
`session_id` text NOT NULL,
|
|
4
|
-
`role` text NOT NULL,
|
|
5
|
-
`instance_id` text,
|
|
6
|
-
`task_id` text,
|
|
7
|
-
`chat_id` text,
|
|
8
|
-
`project_path` text,
|
|
9
|
-
`started_at` text DEFAULT (datetime('now')) NOT NULL,
|
|
10
|
-
`ended_at` text
|
|
11
|
-
);
|
|
12
|
-
--> statement-breakpoint
|
|
13
|
-
ALTER TABLE `tasks` ADD `cc_session_id` text;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ALTER TABLE `projects` ADD `deleted_at` text;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
-- 先删除重复的 cc_sessions 记录(保留每个 session_id 中 id 最小的那条)
|
|
2
|
-
DELETE FROM `cc_sessions` WHERE `id` NOT IN (
|
|
3
|
-
SELECT MIN(`id`) FROM `cc_sessions` GROUP BY `session_id`
|
|
4
|
-
);--> statement-breakpoint
|
|
5
|
-
CREATE UNIQUE INDEX `cc_sessions_session_id_unique` ON `cc_sessions` (`session_id`);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
CREATE TABLE `topics` (
|
|
2
|
-
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
-
`project_id` text REFERENCES `projects`(`project_id`),
|
|
4
|
-
`title` text NOT NULL,
|
|
5
|
-
`description` text,
|
|
6
|
-
`status` text NOT NULL DEFAULT 'active',
|
|
7
|
-
`thread_id` text,
|
|
8
|
-
`chat_id` text,
|
|
9
|
-
`workspace_path` text,
|
|
10
|
-
`branch_name` text,
|
|
11
|
-
`created_by` text,
|
|
12
|
-
`created_at` text NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
|
|
13
|
-
`updated_at` text NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
|
|
14
|
-
`closed_at` text
|
|
15
|
-
);
|
|
16
|
-
--> statement-breakpoint
|
|
17
|
-
CREATE INDEX `idx_topics_thread_id` ON `topics` (`thread_id`);
|
|
18
|
-
--> statement-breakpoint
|
|
19
|
-
CREATE INDEX `idx_topics_status` ON `topics` (`status`);
|
|
20
|
-
--> statement-breakpoint
|
|
21
|
-
ALTER TABLE `tasks` ADD COLUMN `topic_id` text REFERENCES `topics`(`id`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ALTER TABLE `topics` ADD `root_message_id` text;
|