- Fix UV index strategy: mark PyTorch CPU index as explicit with name - Add --index-strategy unsafe-best-match to Dockerfile uv pip install - Fix redis version constraint (>=5.0,<6) for ARQ compatibility - Fix Anthropic model name (claude-sonnet-4-5-20250929) - Fix IMAGE_PROVIDER enum value (gemini_flash, not google) - Resolve middlewares.py vs middlewares/ package conflict - Fix worker import paths (models.sql.presentation, models.sql.slide, utils split) - Fix seed script FK resolution by importing all related models - Fix test suite: async fixture scoping, greenlet dep, regex patterns, fixture params - Fix frontend TypeScript error (Boolean cast for layout.react_code) - Regenerate package-lock.json with i18n packages - Add initial Alembic migration (autogenerated from all models) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
"""Seed the database with the default Oliver Team."""
|
|
import asyncio
|
|
import uuid
|
|
from datetime import datetime, timezone
|
|
|
|
from sqlmodel import select
|
|
from services.database import async_session_maker
|
|
|
|
# Import all models so SQLAlchemy resolves FK references
|
|
from models.sql.client import ClientModel # noqa: F401
|
|
from models.sql.user import UserModel # noqa: F401
|
|
from models.sql.team import TeamModel
|
|
from models.sql.team_membership import TeamMembershipModel # noqa: F401
|
|
|
|
|
|
async def seed():
|
|
async with async_session_maker() as session:
|
|
result = await session.execute(
|
|
select(TeamModel).where(TeamModel.is_default == True) # noqa: E712
|
|
)
|
|
existing = result.scalar_one_or_none()
|
|
|
|
if existing:
|
|
print(f"Oliver Team already exists (id: {existing.id}), skipping seed.")
|
|
return
|
|
|
|
oliver_team = TeamModel(
|
|
id=uuid.uuid4(),
|
|
name="Oliver Team",
|
|
client_id=None,
|
|
is_default=True,
|
|
created_at=datetime.now(timezone.utc),
|
|
)
|
|
session.add(oliver_team)
|
|
await session.commit()
|
|
print(f"Created Oliver Team with id: {oliver_team.id}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(seed())
|