Rescan tech review reports when a new version of Delphi is ran (#5433)

* Delphi rescan when version changes

* Fix inserting duplicate reports when rescanning

* upsert report issue details instead of deleting

* fix up rescan stuff
This commit is contained in:
aecsocket
2026-03-03 17:44:30 +00:00
committed by GitHub
parent 63daac917b
commit 34997bada5
16 changed files with 442 additions and 10 deletions

View File

@@ -182,6 +182,27 @@ pub struct DelphiReportIssueResult {
}
impl DBDelphiReportIssue {
pub async fn upsert(
&self,
transaction: &mut PgTransaction<'_>,
) -> Result<DelphiReportIssueId, DatabaseError> {
Ok(DelphiReportIssueId(
sqlx::query_scalar!(
"
INSERT INTO delphi_report_issues (report_id, issue_type)
VALUES ($1, $2)
ON CONFLICT (report_id, issue_type) DO UPDATE SET
issue_type = EXCLUDED.issue_type
RETURNING id
",
self.report_id as DelphiReportId,
self.issue_type,
)
.fetch_one(&mut *transaction)
.await?,
))
}
pub async fn insert(
&self,
transaction: &mut PgTransaction<'_>,