25 lines
1.1 KiB
SQL
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`); |