Files
mtgonline/backend/scripts/run_migrations.sh
T
akadmin c42d7ca0e1 feat: implement user data schema and API endpoints
- Add Alembic migration setup with async configuration
- Create 16 user data models (users, decks, cards, replays, etc.)
- Implement comprehensive API endpoints with JWT auth
- Add replay, card collection, group, network, preferences, and activity log routers
- Include API documentation and migration test plan
- Update Dockerfile to run migrations on startup
2026-07-23 03:23:54 +00:00

33 lines
816 B
Bash

#!/bin/bash
# Run Alembic migrations with database connectivity check
set -e
echo "Running Alembic migrations..."
# Check if database is reachable
echo "Checking database connectivity..."
until python -c "
import asyncio
from sqlalchemy.ext.asyncio import create_async_engine
async def check():
engine = create_async_engine('postgresql+asyncpg://mtgonline_user:mtgonline_password@postgres:5432/mtgonline')
async with engine.connect() as conn:
await conn.execute(sqlalchemy.text('SELECT 1'))
await engine.dispose()
print('Database connection successful')
import sqlalchemy
asyncio.run(check())
" 2>/dev/null; do
echo "Waiting for database to be ready..."
sleep 2
done
# Run migrations
echo "Applying migrations..."
alembic upgrade head
echo "Migrations completed successfully!"