Files
Codewalkers/apps/server/drizzle/0024_add_conversations.sql
Lukas May b11cae998c refactor: Co-locate server artifacts under apps/server/
Move drizzle/, dist/, and coverage/ into apps/server/ so all
server-specific artifacts live alongside the source they belong to.

- git mv drizzle/ → apps/server/drizzle/
- drizzle.config.ts: out → ./apps/server/drizzle
- tsconfig.json: outDir → ./apps/server/dist, exclude drizzle dir
- package.json: main/bin/clean point to apps/server/dist/
- vitest.config.ts: reportsDirectory → ./apps/server/coverage
- .gitignore: add coverage/ entry
- ensure-schema.ts: update getMigrationsPath() for new layout
- docs/database-migrations.md: update drizzle/ references
2026-03-03 11:55:12 +01:00

19 lines
819 B
SQL

-- Inter-agent conversations
CREATE TABLE `conversations` (
`id` text PRIMARY KEY NOT NULL,
`from_agent_id` text NOT NULL REFERENCES `agents`(`id`) ON DELETE CASCADE,
`to_agent_id` text NOT NULL REFERENCES `agents`(`id`) ON DELETE CASCADE,
`initiative_id` text REFERENCES `initiatives`(`id`) ON DELETE SET NULL,
`phase_id` text REFERENCES `phases`(`id`) ON DELETE SET NULL,
`task_id` text REFERENCES `tasks`(`id`) ON DELETE SET NULL,
`question` text NOT NULL,
`answer` text,
`status` text DEFAULT 'pending' NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL
);
--> statement-breakpoint
CREATE INDEX `conversations_to_agent_status_idx` ON `conversations` (`to_agent_id`, `status`);
--> statement-breakpoint
CREATE INDEX `conversations_from_agent_idx` ON `conversations` (`from_agent_id`);