Files
microdao-daarion/services/city-service/migrations.py
Apple a6e531a098 fix: NODE1_REPAIR - healthchecks, dependencies, SSR env, telegram gateway
TASK_PHASE_NODE1_REPAIR:
- Fix daarion-web SSR: use CITY_API_BASE_URL instead of 127.0.0.1
- Fix auth API routes: use AUTH_API_URL env var
- Add wget to Dockerfiles for healthchecks (stt, ocr, web-search, swapper, vector-db, rag)
- Update healthchecks to use wget instead of curl
- Fix vector-db-service: update torch==2.4.0, sentence-transformers==2.6.1
- Fix rag-service: correct haystack imports for v2.x
- Fix telegram-gateway: remove msg.ack() for non-JetStream NATS
- Add /health endpoint to nginx mvp-routes.conf
- Add room_role, is_public, sort_order columns to city_rooms migration
- Add TASK_PHASE_NODE1_REPAIR.md and DEPLOY_NODE1_REPAIR.md docs

Previous tasks included:
- TASK 039-044: Orchestrator rooms, Matrix chat cleanup, CrewAI integration
2025-11-29 05:17:08 -08:00

50 lines
1.6 KiB
Python

import asyncpg
import os
import logging
logger = logging.getLogger(__name__)
DATABASE_URL = os.getenv("DATABASE_URL", "postgresql://postgres:postgres@localhost:5432/daarion")
async def run_migrations():
conn = None
try:
conn = await asyncpg.connect(DATABASE_URL)
# Add logo_url and banner_url to microdaos table (previous task)
await conn.execute("""
ALTER TABLE microdaos
ADD COLUMN IF NOT EXISTS logo_url TEXT,
ADD COLUMN IF NOT EXISTS banner_url TEXT;
""")
# Add logo_url and banner_url to city_rooms table (previous task)
await conn.execute("""
ALTER TABLE city_rooms
ADD COLUMN IF NOT EXISTS logo_url TEXT,
ADD COLUMN IF NOT EXISTS banner_url TEXT;
""")
# NEW: Add crew_team_key to agents table (TASK 044)
await conn.execute("""
ALTER TABLE agents
ADD COLUMN IF NOT EXISTS crew_team_key TEXT;
""")
logger.info("Migration: Added crew_team_key to agents table.")
# TASK 044: Add room_role, is_public, sort_order to city_rooms table
await conn.execute("""
ALTER TABLE city_rooms
ADD COLUMN IF NOT EXISTS room_role TEXT,
ADD COLUMN IF NOT EXISTS is_public BOOLEAN DEFAULT TRUE,
ADD COLUMN IF NOT EXISTS sort_order INTEGER DEFAULT 100;
""")
logger.info("Migration: Added room_role, is_public, sort_order to city_rooms table.")
except Exception as e:
logger.error(f"Error running migrations: {e}")
raise
finally:
if conn:
await conn.close()