CREATE TABLE `errands` (
	`id` text PRIMARY KEY NOT NULL,
	`description` text NOT NULL,
	`branch` text NOT NULL,
	`base_branch` text DEFAULT 'main' NOT NULL,
	`agent_id` text,
	`project_id` text NOT NULL,
	`status` text DEFAULT 'active' NOT NULL,
	`created_at` integer NOT NULL,
	`updated_at` integer NOT NULL,
	`conflict_files` text,
	FOREIGN KEY (`agent_id`) REFERENCES `agents`(`id`) ON UPDATE no action ON DELETE set null,
	FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE INDEX `errands_project_id_idx` ON `errands` (`project_id`);--> statement-breakpoint
CREATE INDEX `errands_status_idx` ON `errands` (`status`);