Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Database initialization script for Gemini MCP Server | |
| Run this script to create all database tables | |
| """ | |
| from database import engine, Base | |
| from models import ChatMessage, User, Tenant | |
| import os | |
| def init_database(): | |
| """Initialize the database with all tables""" | |
| print("π Initializing database...") | |
| try: | |
| # Create all tables | |
| Base.metadata.create_all(bind=engine) | |
| print("β Database tables created successfully!") | |
| # Show created tables | |
| print("\nπ Created tables:") | |
| for table_name in Base.metadata.tables.keys(): | |
| print(f" - {table_name}") | |
| print(f"\nπΎ Database location: {os.getenv('DATABASE_URL', 'sqlite:///./mcp_server.db')}") | |
| print("π Database initialization complete!") | |
| except Exception as e: | |
| print(f"β Error initializing database: {str(e)}") | |
| return False | |
| return True | |
| if __name__ == "__main__": | |
| init_database() |