26 lines
530 B
Bash
26 lines
530 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
echo "Waiting for database..."
|
|
sleep 3
|
|
|
|
echo "Resetting database schema..."
|
|
python -c "
|
|
from app.database import engine
|
|
from app.models import Base
|
|
import sqlalchemy as sa
|
|
|
|
# Drop all tables for clean v2 schema
|
|
print('Dropping old tables...')
|
|
Base.metadata.drop_all(bind=engine)
|
|
print('Creating new tables...')
|
|
Base.metadata.create_all(bind=engine)
|
|
print('Schema ready.')
|
|
"
|
|
|
|
echo "Seeding data..."
|
|
python /app/seed.py
|
|
|
|
echo "Starting server..."
|
|
exec uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 1
|