Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions drizzle/0008_old_ken_ellis.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
CREATE TABLE IF NOT EXISTS `automation_run_logs` (
`id` text PRIMARY KEY NOT NULL,
`automation_id` text NOT NULL,
`started_at` text NOT NULL,
`finished_at` text,
`status` text NOT NULL,
`error` text,
`task_id` text,
FOREIGN KEY (`automation_id`) REFERENCES `automations`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`task_id`) REFERENCES `tasks`(`id`) ON UPDATE no action ON DELETE set null
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS `automations` (
`id` text PRIMARY KEY NOT NULL,
`project_id` text NOT NULL,
`project_name` text DEFAULT '' NOT NULL,
`name` text NOT NULL,
`prompt` text NOT NULL,
`agent_id` text NOT NULL,
`mode` text DEFAULT 'schedule' NOT NULL,
`schedule` text NOT NULL,
`trigger_type` text,
`trigger_config` text,
`use_worktree` integer DEFAULT 1 NOT NULL,
`status` text DEFAULT 'active' NOT NULL,
`last_run_at` text,
`next_run_at` text,
`run_count` integer DEFAULT 0 NOT NULL,
`last_run_result` text,
`last_run_error` text,
`created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
`updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS `idx_automation_run_logs_automation_started` ON `automation_run_logs` (`automation_id`,`started_at`);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS `idx_automation_run_logs_status` ON `automation_run_logs` (`status`);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS `idx_automations_project_id` ON `automations` (`project_id`);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS `idx_automations_status_next_run` ON `automations` (`status`,`next_run_at`);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS `idx_automations_updated_at` ON `automations` (`updated_at`);
Loading