04/23 Enhance app functionalities 2

This commit is contained in:
2026-04-23 17:32:44 -04:00
parent f4eea48e4d
commit 58c6218c14
8 changed files with 609 additions and 28 deletions
+18
View File
@@ -402,6 +402,24 @@ def initialize_database():
conn.commit()
logger.info("Migration: added visibility column to websites table.")
# Confirm creation of new tables added post-initial-deployment
# These use CREATE TABLE IF NOT EXISTS so they are safe on first run.
# We log confirmation so operators can verify the upgrade applied.
for new_table in ("ai_criteria", "ai_analysis_log"):
cursor.execute(
"""
SELECT COUNT(*) FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = %s
""",
(new_table,)
)
(table_exists,) = cursor.fetchone()
if table_exists:
logger.info(f"Table '{new_table}' confirmed present.")
else:
logger.warning(f"Table '{new_table}' was not created — check DDL.")
# Seed default admin if users table is empty
cursor.execute("SELECT COUNT(*) FROM users")
(count,) = cursor.fetchone()