Skip to content

Commit

Permalink
Schema doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
P-T-I committed Apr 22, 2024
1 parent d63143e commit 96bd636
Showing 1 changed file with 33 additions and 5 deletions.
38 changes: 33 additions & 5 deletions CveXplore/database_models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@


class Info(CveXploreBase):
"""
Information about the time the last update was made to a db table.
"""

__tablename__ = "info"
id = Column(Integer, primary_key=True, doc="ID of the record")
db = Column(String(25), doc="Database name")
Expand All @@ -26,6 +30,10 @@ def __repr__(self):


class Schema(CveXploreBase):
"""
Holds information about the current database schema.
"""

__tablename__ = "schema"
id = Column(Integer, primary_key=True, doc="ID of the record")
rebuild_needed = Column(Boolean, default=False, doc="Flag to indicate if a rebuild is needed")
Expand All @@ -36,6 +44,10 @@ def __repr__(self):


class Capec(CveXploreBase):
"""
CAPEC database table.
"""

__tablename__ = "capec"
id = Column(Integer, primary_key=True, unique=True, index=True, doc="ID of the CAPEC")
loa = Column(String(25), index=True, doc="Likelihood Of Attack")
Expand All @@ -54,6 +66,10 @@ def __repr__(self):


class Cpe(CveXploreBase):
"""
CPE database table.
"""

__tablename__ = "cpe"
_id = Column(BigInteger, primary_key=True, unique=True, index=True, doc="ID of the record")
id = Column(String(50), unique=True, index=True, doc="ID of the CPE")
Expand All @@ -75,6 +91,10 @@ def __repr__(self):


class Cves(CveXploreBase):
"""
CVE database table.
"""

__tablename__ = "cves"
_id = Column(BigInteger, primary_key=True, unique=True, index=True, doc="ID of the record")
id = Column(String(50), unique=True, index=True, doc="ID of the CVE")
Expand Down Expand Up @@ -111,6 +131,10 @@ def __repr__(self):


class Cwe(CveXploreBase):
"""
CWE database table.
"""

__tablename__ = "cwe"
id = Column(Integer, primary_key=True, unique=True, index=True, doc="ID of the record")
description = Column(Text, doc="Description of the CWE")
Expand All @@ -124,15 +148,19 @@ def __repr__(self):


class Via4(CveXploreBase):
"""
VIA4 database table.
"""

__tablename__ = "via4"
_id = Column(Integer, primary_key=True, unique=True, index=True, doc="ID of the record")
id = Column(String(50), index=True, doc="ID of the Via4")
db = Column(String(25), doc="Database name")
searchables = Column(JSON, default=[], ddoc="Via4 searchables")
sources = Column(JSON, default=[], doc="Via4 sources")
msbulletin = Column(JSON, default=[], doc="Via4 msbulletin")
redhat = Column(JSON, default={}, doc="Via4 redhat")
refmap = Column(JSON, default={}, doc="Via4 refmap")
searchables = Column(JSON, default=[], doc="VIA4 searchables")
sources = Column(JSON, default=[], doc="VIA4 sources")
msbulletin = Column(JSON, default=[], doc="VIA4 msbulletin")
redhat = Column(JSON, default={}, doc="VIA4 redhat")
refmap = Column(JSON, default={}, doc="VIA4 refmap")

def __repr__(self):
return f"<< Via4: {self.db} >>"
Expand Down

0 comments on commit 96bd636

Please sign in to comment.