peppa/packages/db/migrations/0019_stormy_vin_gonzales.sql
Асель fec0a698e7 PEP-143: feedback table, core, feedback agent tick, bot mode and buttons
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-16 11:23:09 +05:00

25 lines
1.1 KiB
SQL

CREATE TABLE `feedback` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`user_id` integer NOT NULL,
`via` text NOT NULL,
`text` text NOT NULL,
`context` text DEFAULT '{}' NOT NULL,
`screenshots` text DEFAULT '[]' NOT NULL,
`status` text DEFAULT 'received' NOT NULL,
`analysis` text,
`analysis_error` text,
`analysis_started_at` integer,
`task_id` integer,
`option_index` integer,
`reject_reason` text,
`decided_by` integer,
`decided_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 (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`task_id`) REFERENCES `tasks`(`id`) ON UPDATE no action ON DELETE set null,
FOREIGN KEY (`decided_by`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null
);
--> statement-breakpoint
CREATE INDEX `feedback_user` ON `feedback` (`user_id`,`created_at`);--> statement-breakpoint
CREATE INDEX `feedback_status` ON `feedback` (`status`);