File size: 1,049 Bytes
85d69fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/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()