mirror of
https://github.com/ysoftdevs/odc-analyzer.git
synced 2026-01-18 09:38:14 +01:00
Switch to PostgreSQL
This commit is contained in:
@@ -5,7 +5,7 @@ import slick.lifted.Tag
|
||||
|
||||
final case class CpeEntry(cpe: String, vendor: String, product: String)
|
||||
|
||||
class CpeEntries(tag: Tag) extends Table[(Int, CpeEntry)](tag, "cpeEntry") {
|
||||
class CpeEntries(tag: Tag) extends Table[(Int, CpeEntry)](tag, "cpeentry") {
|
||||
|
||||
def id = column[Int]("id", O.PrimaryKey)
|
||||
|
||||
|
||||
@@ -32,9 +32,9 @@ final case class SoftwareVulnerability (vulnerabilityId: Int, cpeEntryId: Int, i
|
||||
|
||||
class SoftwareVulnerabilities(tag: Tag) extends Table[SoftwareVulnerability](tag, "software") {
|
||||
def vulnerabilityId = column[Int]("cveid")
|
||||
def cpeEntryId = column[Int]("cpeEntryId")
|
||||
def cpeEntryId = column[Int]("cpeentryid")
|
||||
//private val bt = new OdcBooleanType()(jdbcTypeFor(implicitly[BaseColumnType[String]].optionType).asInstanceOf[JdbcType[Option[String]]])
|
||||
//MappedJdbcType.base[Boolean, Option[String]](???, ???)(implicitly[ClassTag[Boolean]], )
|
||||
def includesAllPreviousVersionsRaw = column[String]("previousVersion").?
|
||||
def includesAllPreviousVersionsRaw = column[String]("previousversion").?
|
||||
def * = (vulnerabilityId, cpeEntryId, includesAllPreviousVersionsRaw) <> (SoftwareVulnerability.tupled, SoftwareVulnerability.unapply)
|
||||
}
|
||||
@@ -10,13 +10,13 @@ class Vulnerabilities(tag: Tag) extends Table[(Int, Vulnerability)](tag, "vulner
|
||||
def cve = column[String]("cve")
|
||||
def description = column[String]("description")
|
||||
def cweOption = column[String]("cwe").?
|
||||
def cvssScore = column[Double]("cvssScore").?
|
||||
def authentication = column[String]("cvssAuthentication").?
|
||||
def availabilityImpact = column[String]("cvssAvailabilityImpact").?
|
||||
def accessVector = column[String]("cvssAccessVector").?
|
||||
def integrityImpact = column[String]("cvssIntegrityImpact").?
|
||||
def cvssAccessComplexity = column[String]("cvssAccessComplexity").?
|
||||
def cvssConfidentialityImpact = column[String]("cvssConfidentialityImpact").?
|
||||
def cvssScore = column[Double]("cvssscore").?
|
||||
def authentication = column[String]("cvssauthentication").?
|
||||
def availabilityImpact = column[String]("cvssavailabilityimpact").?
|
||||
def accessVector = column[String]("cvssaccessvector").?
|
||||
def integrityImpact = column[String]("cvssintegrityimpact").?
|
||||
def cvssAccessComplexity = column[String]("cvssaccesscomplexity").?
|
||||
def cvssConfidentialityImpact = column[String]("cvssconfidentialityimpact").?
|
||||
|
||||
def cvssRating = (cvssScore, authentication, availabilityImpact, accessVector, integrityImpact, cvssAccessComplexity, cvssConfidentialityImpact) <> (CvssRating.tupled, CvssRating.unapply)
|
||||
def cweOptionMapped = cweOption <> ((_: Option[String]).map(CWE.forIdentifierWithDescription), (_: Option[CWE]).map(CWE.unapply))
|
||||
|
||||
@@ -4,7 +4,7 @@ import slick.lifted.TableQuery
|
||||
|
||||
package object odc {
|
||||
|
||||
val profile = slick.driver.MySQLDriver
|
||||
val profile = slick.driver.PostgresDriver
|
||||
|
||||
object tables {
|
||||
val cpeEntries = TableQuery[CpeEntries]
|
||||
|
||||
@@ -11,7 +11,8 @@ class OdcModule extends AbstractModule with ScalaModule{
|
||||
override def configure(): Unit = {}
|
||||
|
||||
private val Drivers = Map(
|
||||
"slick.driver.MySQLDriver$" -> "org.mariadb.jdbc.Driver"
|
||||
"slick.driver.MySQLDriver$" -> "org.mariadb.jdbc.Driver",
|
||||
"slick.driver.PostgresDriver$" -> "org.postgresql.Driver"
|
||||
)
|
||||
|
||||
@Provides
|
||||
|
||||
Reference in New Issue
Block a user