Spaces:
Runtime error
Runtime error
| #!/usr/bin/env python3 | |
| import os | |
| import sys | |
| from sqlalchemy import create_engine, text | |
| # Use SQLite for development | |
| DATABASE_URL = "sqlite:///./customeragent.db" | |
| def add_needs_attention_column(): | |
| try: | |
| engine = create_engine(DATABASE_URL) | |
| with engine.connect() as conn: | |
| # Check if column exists | |
| result = conn.execute(text("PRAGMA table_info(chat_sessions)")) | |
| columns = [row[1] for row in result.fetchall()] | |
| if 'needs_attention' not in columns: | |
| conn.execute(text("ALTER TABLE chat_sessions ADD COLUMN needs_attention BOOLEAN DEFAULT 0")) | |
| conn.commit() | |
| print("Successfully added needs_attention column") | |
| else: | |
| print("Column needs_attention already exists") | |
| except Exception as e: | |
| print(f"Error: {e}") | |
| if __name__ == "__main__": | |
| add_needs_attention_column() |