96 lines
3.6 KiB
Python

"""
Seed the database with initial data (exercises, phases).
Run with: python scripts/seed.py
"""
import asyncio
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent))
from sqlalchemy import select
from app.models import async_session
from app.models.exercise import Exercise
from app.models.workout import Phase
EXERCISES = [
# Push
("Bench Press", "chest", "barbell, bench"),
("Incline Dumbbell Press", "chest", "dumbbell, bench"),
("Overhead Press", "shoulders", "barbell"),
("Landmine Press", "shoulders", "landmine"),
("Band Press", "chest", "bands"),
("Lateral Raise", "shoulders", "dumbbell"),
("Tricep Pushdown", "triceps", "cable, bands"),
("Dip", "chest", "dip station"),
# Pull
("Barbell Row", "back", "barbell"),
("Dumbbell Row", "back", "dumbbell, bench"),
("Lat Pulldown", "back", "cable, bands"),
("Pull-up", "back", "pull-up bar"),
("Face Pull", "shoulders", "cable, bands"),
("YTW", "shoulders", "dumbbell, bands"),
("Bicep Curl", "biceps", "dumbbell"),
# Legs
("Barbell Squat", "quadriceps", "barbell, squat rack"),
("Goblet Squat", "quadriceps", "dumbbell, kettlebell"),
("Bulgarian Split Squat", "quadriceps", "dumbbell, bench"),
("Hip Thrust", "glutes", "barbell, bench"),
("Step-up", "quadriceps", "dumbbell, bench"),
("Romanian Deadlift", "hamstrings", "barbell"),
("Leg Curl", "hamstrings", "cable, bands"),
("Calf Raise", "calves", "barbell, dumbbell"),
("Deadlift", "back", "barbell"),
# Core
("Dead Bug", "core", "bodyweight"),
("Pallof Press", "core", "cable, bands"),
("Plank", "core", "bodyweight"),
("Ab Wheel Rollout", "core", "ab wheel"),
("Russian Twist", "core", "bodyweight, dumbbell"),
("Hanging Knee Raise", "core", "pull-up bar"),
# Cardio
("BikeErg", "cardio", "bikeerg"),
("RowErg", "cardio", "rowerg"),
("Jump Rope", "cardio", "jump rope"),
("Walking", "cardio", "bodyweight"),
# Accessory
("Farmer's Carry", "grip", "dumbbell, kettlebell"),
("Bird Dog", "core", "bodyweight"),
("Glute Bridge", "glutes", "bodyweight"),
("Clamshell", "glutes", "bodyweight, bands"),
("90/90 Stretch", "hips", "bodyweight"),
("Supine Piriformis Stretch", "hips", "bodyweight"),
]
PHASES = [
("Tendon Adaptation", "Phase 1: Return to training after layoff. RPE 6-7, limited ROM, mid-range movements only.", "2026-06-25", None, "Weeks 1-4"),
("Progressive Loading", "Phase 2: Increase load gradually. RPE 7-8, full ROM where tolerated.", None, None, "Weeks 4-8"),
("Strength Building", "Phase 3: Normal training. RPE 8-9, full ROM.", None, None, "Weeks 8+"),
]
async def seed():
async with async_session() as session:
result = await session.execute(select(Exercise).limit(1))
if result.scalar_one_or_none():
print("Exercises already seeded, skipping.")
else:
for name, body_part, equipment in EXERCISES:
session.add(Exercise(name=name, body_part=body_part, equipment=equipment))
print(f"Seeded {len(EXERCISES)} exercises.")
result = await session.execute(select(Phase).limit(1))
if result.scalar_one_or_none():
print("Phases already seeded, skipping.")
else:
for name, desc, start, end, notes in PHASES:
session.add(Phase(name=name, description=desc, start_date=start, end_date=end, notes=notes))
print(f"Seeded {len(PHASES)} phases.")
await session.commit()
if __name__ == "__main__":
asyncio.run(seed())