Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions apps/daemon/drizzle/0010_chilly_swordsman.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ALTER TABLE `session_runs` ADD `run_id` text;--> statement-breakpoint
ALTER TABLE `session_runs` ADD `base_turn_id` text;--> statement-breakpoint
CREATE UNIQUE INDEX `session_runs_run_id_unique` ON `session_runs` (`run_id`);--> statement-breakpoint
ALTER TABLE `sessions` ADD `origin_source_session_id` text;--> statement-breakpoint
ALTER TABLE `sessions` ADD `origin_source_turn_id` text;--> statement-breakpoint
ALTER TABLE `sessions` ADD `origin_forked_at` integer;--> statement-breakpoint
ALTER TABLE `sessions` ADD `active_leaf_turn_id` text;--> statement-breakpoint
ALTER TABLE `sessions` ADD `graph_revision` integer DEFAULT 0 NOT NULL;--> statement-breakpoint
UPDATE `session_runs` SET `run_id` = 'run-' || lower(hex(randomblob(16))) WHERE `run_id` IS NULL;
56 changes: 56 additions & 0 deletions apps/daemon/drizzle/0011_flippant_bastion.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
CREATE TABLE `conversation_operations` (
`operation_id` text PRIMARY KEY NOT NULL,
`session_id` text NOT NULL,
`kind` text NOT NULL,
`state` text NOT NULL,
`turn_id` text,
`error_code` text,
`error_message` text,
`created_at` integer NOT NULL,
`resolved_at` integer,
FOREIGN KEY (`session_id`) REFERENCES `sessions`(`session_id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE INDEX `conversation_operations_session_idx` ON `conversation_operations` (`session_id`);--> statement-breakpoint
CREATE TABLE `conversation_turns` (
`turn_id` text PRIMARY KEY NOT NULL,
`session_id` text NOT NULL,
`parent_turn_id` text,
`sibling_ordinal` integer NOT NULL,
`input_type` text NOT NULL,
`prompt_id` text,
`command_name` text,
`command_arguments` text,
`shell_command` text,
`run_id` text NOT NULL,
`state` text NOT NULL,
`created_at` integer NOT NULL,
FOREIGN KEY (`session_id`) REFERENCES `sessions`(`session_id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`parent_turn_id`) REFERENCES `conversation_turns`(`turn_id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`prompt_id`) REFERENCES `prompts`(`prompt_id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE INDEX `conversation_turns_session_idx` ON `conversation_turns` (`session_id`);--> statement-breakpoint
CREATE TABLE `prompt_attachment_refs` (
`prompt_id` text NOT NULL,
`attachment_id` text NOT NULL,
PRIMARY KEY(`prompt_id`, `attachment_id`),
FOREIGN KEY (`prompt_id`) REFERENCES `prompts`(`prompt_id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `prompts` (
`prompt_id` text PRIMARY KEY NOT NULL,
`blocks_json` text NOT NULL,
`context_attachment_ids_json` text NOT NULL,
`created_at` integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE `provider_turn_bindings` (
`turn_id` text NOT NULL,
`run_id` text NOT NULL,
`history_id` text NOT NULL,
`checkpoint` text NOT NULL,
`captured_from` text NOT NULL,
PRIMARY KEY(`turn_id`, `history_id`),
FOREIGN KEY (`turn_id`) REFERENCES `conversation_turns`(`turn_id`) ON UPDATE no action ON DELETE cascade
);
3 changes: 3 additions & 0 deletions apps/daemon/drizzle/0012_overjoyed_risque.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE UNIQUE INDEX `conversation_operations_open_session_unique` ON `conversation_operations` (`session_id`) WHERE state = 'open';--> statement-breakpoint
CREATE UNIQUE INDEX `conversation_turns_sibling_unique` ON `conversation_turns` (`session_id`,`parent_turn_id`,`sibling_ordinal`) WHERE parent_turn_id IS NOT NULL;--> statement-breakpoint
CREATE UNIQUE INDEX `conversation_turns_root_sibling_unique` ON `conversation_turns` (`session_id`,`sibling_ordinal`) WHERE parent_turn_id IS NULL;
Loading
Loading