@crewx/sdk 0.9.0-rc.62 → 0.9.0-rc.63

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.
@@ -0,0 +1,71 @@
1
+ CREATE TABLE IF NOT EXISTS `project_criteria` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `project_id` text NOT NULL,
4
+ `position` integer NOT NULL,
5
+ `statement` text NOT NULL,
6
+ `verify_status` text DEFAULT 'pending' NOT NULL,
7
+ `verified_at` text,
8
+ `evidence_json` text DEFAULT '[]' NOT NULL,
9
+ `created_at` text NOT NULL,
10
+ `updated_at` text NOT NULL,
11
+ FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade,
12
+ CONSTRAINT "project_criteria_id_ck" CHECK("project_criteria"."id" GLOB 'pjc_*'),
13
+ CONSTRAINT "project_criteria_verify_status_ck" CHECK("project_criteria"."verify_status" IN ('pending', 'verifying', 'passed', 'failed')),
14
+ CONSTRAINT "project_criteria_evidence_json_ck" CHECK(json_valid("project_criteria"."evidence_json") AND json_type("project_criteria"."evidence_json") = 'array')
15
+ );
16
+ --> statement-breakpoint
17
+ CREATE UNIQUE INDEX IF NOT EXISTS `project_criteria_project_position_uq` ON `project_criteria` (`project_id`,`position`);--> statement-breakpoint
18
+ CREATE TABLE IF NOT EXISTS `project_events` (
19
+ `id` text PRIMARY KEY NOT NULL,
20
+ `project_id` text NOT NULL,
21
+ `seq` integer NOT NULL,
22
+ `actor_type` text NOT NULL,
23
+ `actor_id` text,
24
+ `type` text NOT NULL,
25
+ `title` text NOT NULL,
26
+ `summary` text,
27
+ `payload_json` text DEFAULT '{}' NOT NULL,
28
+ `created_at` text NOT NULL,
29
+ FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE restrict,
30
+ CONSTRAINT "project_events_id_ck" CHECK("project_events"."id" GLOB 'pje_*'),
31
+ CONSTRAINT "project_events_actor_type_ck" CHECK("project_events"."actor_type" IN ('user', 'project_manager', 'system')),
32
+ CONSTRAINT "project_events_payload_json_ck" CHECK(json_valid("project_events"."payload_json") AND json_type("project_events"."payload_json") = 'object')
33
+ );
34
+ --> statement-breakpoint
35
+ CREATE UNIQUE INDEX IF NOT EXISTS `project_events_project_seq_uq` ON `project_events` (`project_id`,`seq`);--> statement-breakpoint
36
+ CREATE TABLE IF NOT EXISTS `projects` (
37
+ `id` text PRIMARY KEY NOT NULL,
38
+ `workspace_id` text NOT NULL,
39
+ `name` text NOT NULL,
40
+ `outcome` text NOT NULL,
41
+ `due_date` text,
42
+ `scene` text DEFAULT 'planning' NOT NULL,
43
+ `stages_json` text NOT NULL,
44
+ `stage_index` integer NOT NULL,
45
+ `created_at` text NOT NULL,
46
+ `updated_at` text NOT NULL,
47
+ `accepted_at` text,
48
+ `archived_at` text,
49
+ CONSTRAINT "projects_id_ck" CHECK("projects"."id" GLOB 'prj_*'),
50
+ CONSTRAINT "projects_scene_ck" CHECK("projects"."scene" IN ('planning', 'plan_review', 'running', 'human_wait', 'limit_wait', 'failed_stop', 'analyzing_feedback', 'replanned', 'awaiting_review', 'accepted')),
51
+ CONSTRAINT "projects_stages_json_ck" CHECK(json_valid("projects"."stages_json") AND json_type("projects"."stages_json") = 'array'),
52
+ CONSTRAINT "projects_stage_index_ck" CHECK("projects"."stage_index" >= 1)
53
+ );
54
+ --> statement-breakpoint
55
+ CREATE TRIGGER IF NOT EXISTS project_events_no_update
56
+ BEFORE UPDATE ON project_events
57
+ BEGIN
58
+ SELECT RAISE(ABORT, 'project_events is append-only');
59
+ END;
60
+ --> statement-breakpoint
61
+ CREATE TRIGGER IF NOT EXISTS project_events_no_delete
62
+ BEFORE DELETE ON project_events
63
+ BEGIN
64
+ SELECT RAISE(ABORT, 'project_events is append-only');
65
+ END;
66
+ --> statement-breakpoint
67
+ UPDATE tasks
68
+ SET project_id = NULL
69
+ WHERE id = 'task_1773657200590_gu3z335oy'
70
+ AND project_id = '9c899c8b05f8d8d8d1df6d904c0a7fa8e5c95f1cb81602423c1e508f8b77d1dc'
71
+ AND workspace_id = '9c899c8b05f8d8d8d1df6d904c0a7fa8e5c95f1cb81602423c1e508f8b77d1dc';