Files
Codewalkers/apps/server/drizzle/0000_bizarre_naoko.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

88 lines
3.0 KiB
SQL

CREATE TABLE `agents` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`task_id` text,
`session_id` text,
`worktree_id` text NOT NULL,
`status` text DEFAULT 'idle' NOT NULL,
`mode` text DEFAULT 'execute' NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
FOREIGN KEY (`task_id`) REFERENCES `tasks`(`id`) ON UPDATE no action ON DELETE set null
);
--> statement-breakpoint
CREATE UNIQUE INDEX `agents_name_unique` ON `agents` (`name`);--> statement-breakpoint
CREATE TABLE `initiatives` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`description` text,
`status` text DEFAULT 'active' NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE `messages` (
`id` text PRIMARY KEY NOT NULL,
`sender_type` text NOT NULL,
`sender_id` text,
`recipient_type` text NOT NULL,
`recipient_id` text,
`type` text DEFAULT 'info' NOT NULL,
`content` text NOT NULL,
`requires_response` integer DEFAULT false NOT NULL,
`status` text DEFAULT 'pending' NOT NULL,
`parent_message_id` text,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
FOREIGN KEY (`sender_id`) REFERENCES `agents`(`id`) ON UPDATE no action ON DELETE set null,
FOREIGN KEY (`recipient_id`) REFERENCES `agents`(`id`) ON UPDATE no action ON DELETE set null,
FOREIGN KEY (`parent_message_id`) REFERENCES `messages`(`id`) ON UPDATE no action ON DELETE set null
);
--> statement-breakpoint
CREATE TABLE `phases` (
`id` text PRIMARY KEY NOT NULL,
`initiative_id` text NOT NULL,
`number` integer NOT NULL,
`name` text NOT NULL,
`description` text,
`status` text DEFAULT 'pending' NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
FOREIGN KEY (`initiative_id`) REFERENCES `initiatives`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `plans` (
`id` text PRIMARY KEY NOT NULL,
`phase_id` text NOT NULL,
`number` integer NOT NULL,
`name` text NOT NULL,
`description` text,
`status` text DEFAULT 'pending' NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
FOREIGN KEY (`phase_id`) REFERENCES `phases`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `task_dependencies` (
`id` text PRIMARY KEY NOT NULL,
`task_id` text NOT NULL,
`depends_on_task_id` text NOT NULL,
`created_at` integer NOT NULL,
FOREIGN KEY (`task_id`) REFERENCES `tasks`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`depends_on_task_id`) REFERENCES `tasks`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `tasks` (
`id` text PRIMARY KEY NOT NULL,
`plan_id` text NOT NULL,
`name` text NOT NULL,
`description` text,
`type` text DEFAULT 'auto' NOT NULL,
`priority` text DEFAULT 'medium' NOT NULL,
`status` text DEFAULT 'pending' NOT NULL,
`order` integer DEFAULT 0 NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
FOREIGN KEY (`plan_id`) REFERENCES `plans`(`id`) ON UPDATE no action ON DELETE cascade
);