Spaces:
Runtime error
Runtime error
| #!/usr/bin/env python3 | |
| """Initialize the database.""" | |
| import os | |
| os.environ['FLASK_ENV'] = 'development' | |
| from app import create_app | |
| from chat_agent.models.base import db | |
| def init_database(): | |
| """Initialize the database with tables.""" | |
| app = create_app() | |
| with app.app_context(): | |
| # Create all tables | |
| db.create_all() | |
| print('Database tables created successfully') | |
| # Verify tables exist | |
| from sqlalchemy import inspect | |
| inspector = inspect(db.engine) | |
| tables = inspector.get_table_names() | |
| print(f'Created tables: {tables}') | |
| if __name__ == "__main__": | |
| init_database() |