04/23 Enhance app functionalities 2
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user