peppa/packages/db/migrations/0004_code_reviewer.sql

27 lines
1.1 KiB
SQL

CREATE TABLE `code_reviews` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`project_id` integer NOT NULL,
`task_id` integer NOT NULL,
`pr_number` integer NOT NULL,
`sha` text NOT NULL,
`state` text DEFAULT 'queued' NOT NULL,
`verdict` text,
`summary` text,
`findings` text DEFAULT '[]' NOT NULL,
`error` text,
`started_at` integer,
`created_at` integer DEFAULT (cast(unixepoch('subsec') * 1000 as integer)) NOT NULL,
`updated_at` integer DEFAULT (cast(unixepoch('subsec') * 1000 as integer)) NOT NULL,
FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`task_id`) REFERENCES `tasks`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `review_settings` (
`project_id` integer PRIMARY KEY NOT NULL,
`enabled` integer DEFAULT false NOT NULL,
`max_iterations` integer DEFAULT 2 NOT NULL,
`rules` text,
`updated_at` integer DEFAULT (cast(unixepoch('subsec') * 1000 as integer)) NOT NULL,
FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade
);