- Add errand-repository.ts port with ErrandRepository, ErrandWithAlias, ErrandStatus types - Add DrizzleErrandRepository adapter with create, findById (left-joins agents for alias), findAll (optional projectId/status filters, desc by createdAt), update, delete - Wire exports into repositories/index.ts and repositories/drizzle/index.ts - Add migration 0035_faulty_human_fly.sql (CREATE TABLE errands) and drizzle snapshot - Add 13 tests covering CRUD, filtering, ordering, agentAlias join, cascade/set-null FK behaviour - Update docs/database.md to document the errands table and ErrandRepository Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
13 lines
490 B
SQL
13 lines
490 B
SQL
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,
|
|
`status` text DEFAULT 'active' NOT NULL,
|
|
`created_at` integer NOT NULL,
|
|
`updated_at` integer NOT NULL,
|
|
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
|
|
); |