Skip to content

Commit

Permalink
Make search actually fast enough
Browse files Browse the repository at this point in the history
  • Loading branch information
credbbl committed Nov 30, 2023
1 parent 4cba7d2 commit 4776244
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/glvd/database/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
Self,
)

from sqlalchemy import ForeignKey
from sqlalchemy import (
ForeignKey,
Index,
)
from sqlalchemy.orm import (
DeclarativeBase,
Mapped,
Expand Down Expand Up @@ -94,11 +97,21 @@ class DebCve(Base):
last_mod: Mapped[datetime] = mapped_column(init=False, server_default=func.now(), onupdate=func.now())
deb_source: Mapped[str] = mapped_column(primary_key=True)
deb_version: Mapped[str] = mapped_column(DebVersion)
debsec_vulnerable: Mapped[bool]
debsec_vulnerable: Mapped[bool] = mapped_column()
data_cpe_match: Mapped[Any]

dist: Mapped[Optional[DistCpe]] = relationship(lazy='selectin', default=None)

__table_args__ = (
Index(
'deb_cve_search',
dist_id,
debsec_vulnerable,
deb_source,
deb_version,
),
)

def merge(self, other: Self) -> None:
self.deb_version = other.deb_version
self.debsec_vulnerable = other.debsec_vulnerable
Expand Down

0 comments on commit 4776244

Please sign in to comment.