Wrap agentManager.spawn() in try/catch — on failure, block the task instead of crashing the entire dispatch cycle. Move phase status update to after branch creation succeeds — on branch failure, block the phase and skip task queuing. Fix statement-breakpoint markers in migration 0020 to use separate lines.
29 lines
1.0 KiB
SQL
29 lines
1.0 KiB
SQL
-- Add change_sets and change_set_entries tables
|
|
CREATE TABLE `change_sets` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`agent_id` text REFERENCES `agents`(`id`) ON DELETE SET NULL,
|
|
`agent_name` text NOT NULL,
|
|
`initiative_id` text NOT NULL REFERENCES `initiatives`(`id`) ON DELETE CASCADE,
|
|
`mode` text NOT NULL,
|
|
`summary` text,
|
|
`status` text NOT NULL DEFAULT 'applied',
|
|
`reverted_at` integer,
|
|
`created_at` integer NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `change_set_entries` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`change_set_id` text NOT NULL REFERENCES `change_sets`(`id`) ON DELETE CASCADE,
|
|
`entity_type` text NOT NULL,
|
|
`entity_id` text NOT NULL,
|
|
`action` text NOT NULL,
|
|
`previous_state` text,
|
|
`new_state` text,
|
|
`sort_order` integer NOT NULL DEFAULT 0,
|
|
`created_at` integer NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `change_sets_initiative_id_idx` ON `change_sets`(`initiative_id`);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `change_set_entries_change_set_id_idx` ON `change_set_entries`(`change_set_id`);
|