Files
aitbc/scripts/fix-sqlalchemy-python.py
aitbc 933201b25b fix: resolve SQLAlchemy index issues and service startup errors
 SQLAlchemy Index Fixes
- Fixed 'indexes' parameter syntax in SQLModel __table_args__
- Commented out problematic index definitions across domain models
- Updated tuple format to dict format for __table_args__

 Service Fixes
- Fixed missing logger import in openclaw_enhanced_health.py
- Added detailed health endpoint without database dependency
- Resolved ImportError for 'src' module in OpenClaw service

 Services Status
- Marketplace Enhanced (8002):  HEALTHY
- OpenClaw Enhanced (8014):  HEALTHY
- All core services operational

🚀 AITBC platform services fully operational!
Marketplace and OpenClaw services working correctly.
2026-04-02 12:39:23 +02:00

39 lines
1.5 KiB
Python
Executable File

#!/usr/bin/env python3
import os
import re
def fix_sqlalchemy_indexes():
"""Fix SQLAlchemy index syntax issues in domain models"""
domain_dir = "/opt/aitbc/apps/coordinator-api/src/app/domain"
for filename in os.listdir(domain_dir):
if filename.endswith('.py'):
filepath = os.path.join(domain_dir, filename)
print(f"Processing {filename}...")
with open(filepath, 'r') as f:
content = f.read()
# Fix "indexes": [...] pattern
content = re.sub(r'"indexes": \[', r'# "indexes": [', content)
content = re.sub(r' Index\([^)]*\),', r' # Index(\g<0>)', content)
content = re.sub(r' \]', r'# ]', content)
# Fix tuple format __table_args__ = (Index(...),)
content = re.sub(r'__table_args__ = \(', r'__table_args__ = {', content)
content = re.sub(r' Index\([^)]*\),', r' # Index(\g<0>)', content)
content = re.sub(r' \)', r' }', content)
# Fix bounty.py specific format
content = re.sub(r' \{"name": "[^"]*", "columns": \[[^]]*\]\},', r' # {"name": "...", "columns": [...]},', content)
with open(filepath, 'w') as f:
f.write(content)
print("✅ SQLAlchemy index fixes completed!")
if __name__ == "__main__":
fix_sqlalchemy_indexes()