This commit is contained in:
Mateusz Gruszczyński
2026-02-14 09:14:52 +01:00
parent 4c83c72308
commit 804e74aaa9
2 changed files with 571 additions and 46 deletions

View File

@@ -76,6 +76,7 @@ class CVEHandler:
cwe_ids TEXT,
affected_products TEXT,
raw_data TEXT,
discord_notified INTEGER DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
@@ -98,6 +99,18 @@ class CVEHandler:
cursor.execute("CREATE INDEX IF NOT EXISTS idx_published_date ON cve_cache(published_date DESC)")
cursor.execute("CREATE INDEX IF NOT EXISTS idx_cvss_score ON cve_cache(cvss_score DESC)")
cursor.execute("CREATE INDEX IF NOT EXISTS idx_updated_at ON cve_cache(updated_at DESC)")
cursor.execute("CREATE INDEX IF NOT EXISTS idx_discord_notified ON cve_cache(discord_notified)")
cursor.execute("PRAGMA table_info(cve_cache)")
columns = [col[1] for col in cursor.fetchall()]
if 'discord_notified' not in columns:
logger.info("Adding discord_notified column to existing table...")
cursor.execute("""
ALTER TABLE cve_cache
ADD COLUMN discord_notified INTEGER DEFAULT 0
""")
logger.info("✓ Column added successfully")
logger.info(f"Database initialized at {self.db_path}")