compassmock/drizzle/0000_nice_sabra.sql
Nicholai 67fed00bbd feat(schedule): add gantt schedule with task management and dependencies
Implements the schedule module for COMPASS construction PM:

- D1/Drizzle schema: tasks, dependencies, phases tables
- frappe-gantt integration for interactive timeline view
- Critical path analysis (forward/backward pass, float calc)
- Dependency validation with cycle detection
- Business day calculations (skip weekends/holidays)
- Date propagation engine for cascading schedule changes
- Task CRUD with phase assignment and progress tracking
- Dependency management (FS/FF/SS/SF with lag support)
- Dual view: sortable list view + gantt chart view

Also includes full Next.js app scaffold with dashboard,
shadcn/ui components, and Cloudflare Workers deployment config.
2026-01-23 19:34:24 -07:00

33 lines
1.1 KiB
SQL
Executable File

CREATE TABLE `projects` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`created_at` text NOT NULL
);
--> statement-breakpoint
CREATE TABLE `schedule_tasks` (
`id` text PRIMARY KEY NOT NULL,
`project_id` text NOT NULL,
`title` text NOT NULL,
`start_date` text NOT NULL,
`workdays` integer NOT NULL,
`end_date_calculated` text NOT NULL,
`phase` text NOT NULL,
`status` text DEFAULT 'PENDING' NOT NULL,
`is_critical_path` integer DEFAULT false NOT NULL,
`is_milestone` integer DEFAULT false NOT NULL,
`sort_order` integer DEFAULT 0 NOT NULL,
`created_at` text NOT NULL,
`updated_at` text NOT NULL,
FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `task_dependencies` (
`id` text PRIMARY KEY NOT NULL,
`predecessor_id` text NOT NULL,
`successor_id` text NOT NULL,
`type` text DEFAULT 'FS' NOT NULL,
`lag_days` integer DEFAULT 0 NOT NULL,
FOREIGN KEY (`predecessor_id`) REFERENCES `schedule_tasks`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`successor_id`) REFERENCES `schedule_tasks`(`id`) ON UPDATE no action ON DELETE cascade
);