From f20e88b2468bdcdb631b14e384f1f9a67e984013 Mon Sep 17 00:00:00 2001
From: Aleksandr Nogikh <nogikh@google.com>
Date: Thu, 13 Feb 2025 11:57:14 +0100
Subject: syz-cluster: report session results

Provide an API to set up the reporting of finished sessions for which
syz-cluster collected reportable findings.

The actual sending of the results is to be done in a separate component
that would:
1) Call Next() to get the next report to send.
2) Call Confirm() to confirm that the report has been sent.
3) Call Upstream() if the report has been moderated and needs to be sent
   to e.g. public mailing lists.
---
 syz-cluster/pkg/db/migrations/1_initialize.up.sql | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'syz-cluster/pkg/db/migrations/1_initialize.up.sql')

diff --git a/syz-cluster/pkg/db/migrations/1_initialize.up.sql b/syz-cluster/pkg/db/migrations/1_initialize.up.sql
index 0be0c7cef..e7a1b396d 100644
--- a/syz-cluster/pkg/db/migrations/1_initialize.up.sql
+++ b/syz-cluster/pkg/db/migrations/1_initialize.up.sql
@@ -61,6 +61,7 @@ CREATE TABLE Sessions (
 ) PRIMARY KEY(ID);
 
 ALTER TABLE Series ADD CONSTRAINT FK_SeriesLatestSession FOREIGN KEY (LatestSessionID) REFERENCES Sessions (ID);
+CREATE INDEX SessionsByFinishedAt ON Sessions (FinishedAt);
 
 -- Individual tests/steps completed within a session.
 CREATE TABLE SessionTests (
@@ -94,3 +95,16 @@ CREATE TABLE Findings (
 ) PRIMARY KEY (ID);
 
 CREATE UNIQUE INDEX NoDupFindings ON Findings(SessionID, TestName, Title);
+
+-- Session's bug reports.
+CREATE TABLE SessionReports (
+    ID STRING(36) NOT NULL, -- UUID??
+    SessionID STRING(36) NOT NULL, -- UUID
+    ReportedAt TIMESTAMP,
+    Moderation BOOL,
+    Link STRING(256),
+    CONSTRAINT FK_SessionReports FOREIGN KEY (SessionID) REFERENCES Sessions (ID),
+) PRIMARY KEY(ID);
+
+CREATE UNIQUE INDEX NoDupSessionReports ON SessionReports(SessionID, Moderation);
+CREATE INDEX SessionReportsByStatus ON SessionReports (Moderation, ReportedAt);
-- 
cgit mrf-deployment

