Switch to PostgreSQL

This commit is contained in:
Šesták Vít
2020-01-23 10:02:05 +01:00
parent 7dfe71b8b9
commit 2db75d0617
7 changed files with 15 additions and 18 deletions

View File

@@ -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)

View File

@@ -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)
}

View File

@@ -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))

View File

@@ -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]

View File

@@ -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