| 123456789101112131415161718192021222324252627282930313233 |
- CREATE TABLE `schedule_runs` (
- `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
- `schedule_id` text NOT NULL,
- `ts` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')) NOT NULL,
- `outcome` text NOT NULL,
- `run_id` text,
- `cost_usd` real,
- `note` text
- );
- --> statement-breakpoint
- CREATE INDEX `schedule_runs_idx` ON `schedule_runs` (`schedule_id`,`id`);--> statement-breakpoint
- CREATE TABLE `schedules` (
- `id` text PRIMARY KEY NOT NULL,
- `session_id` text,
- `team_id` text,
- `created_by_bot_id` text,
- `title` text NOT NULL,
- `prompt` text NOT NULL,
- `spec` text NOT NULL,
- `timezone` text NOT NULL,
- `status` text DEFAULT 'active' NOT NULL,
- `status_note` text,
- `next_run_at` text,
- `last_run_at` text,
- `last_outcome` text,
- `run_count` integer DEFAULT 0 NOT NULL,
- `created_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')) NOT NULL,
- `updated_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')) NOT NULL
- );
- --> statement-breakpoint
- CREATE INDEX `schedules_due_idx` ON `schedules` (`status`,`next_run_at`);--> statement-breakpoint
- CREATE INDEX `schedules_session_idx` ON `schedules` (`session_id`);--> statement-breakpoint
- CREATE INDEX `schedules_team_idx` ON `schedules` (`team_id`);
|