diff --git a/scanner/src/main/kotlin/storages/PackageBasedPostgresStorage.kt b/scanner/src/main/kotlin/storages/PackageBasedPostgresStorage.kt index 9538a4e0a2e96..3c86671352eef 100644 --- a/scanner/src/main/kotlin/storages/PackageBasedPostgresStorage.kt +++ b/scanner/src/main/kotlin/storages/PackageBasedPostgresStorage.kt @@ -126,7 +126,7 @@ class PackageBasedPostgresStorage( return runCatching { database.transaction { ScanResultDao.find { - var expression = (ScanResults.identifier eq pkg.id.toCoordinates()) + var expression = ScanResults.identifier eq pkg.id scannerMatcher?.regScannerName?.let { expression = expression and (rawParam("scan_result->'scanner'->>'name'") tilde it) diff --git a/scanner/src/main/kotlin/storages/utils/ScanResultDao.kt b/scanner/src/main/kotlin/storages/utils/ScanResultDao.kt index d980b8273125c..f0cc37f5e9f64 100644 --- a/scanner/src/main/kotlin/storages/utils/ScanResultDao.kt +++ b/scanner/src/main/kotlin/storages/utils/ScanResultDao.kt @@ -23,18 +23,22 @@ import org.jetbrains.exposed.dao.IntEntity import org.jetbrains.exposed.dao.IntEntityClass import org.jetbrains.exposed.dao.id.EntityID import org.jetbrains.exposed.dao.id.IntIdTable +import org.jetbrains.exposed.sql.Column import org.ossreviewtoolkit.model.Identifier import org.ossreviewtoolkit.model.ScanResult object ScanResults : IntIdTable("scan_results") { - val identifier = text("identifier").index("identifier") + val identifier: Column = text("identifier") + .transform({ Identifier(it) }, { it.toCoordinates() }) + .index("identifier") + val scanResult = jsonb("scan_result") } class ScanResultDao(id: EntityID) : IntEntity(id) { companion object : IntEntityClass(ScanResults) - var identifier: Identifier by ScanResults.identifier.transform({ it.toCoordinates() }, { Identifier(it) }) + var identifier: Identifier by ScanResults.identifier var scanResult: ScanResult by ScanResults.scanResult }