Files
pixel/backend/alembic/versions/add_provider_to_tasks.py
张鹏 f9f4560459 Initial commit: Pixel AI comic/video creation platform
- FastAPI backend with SQLModel, Alembic migrations, AgentScope agents
- Next.js 15 frontend with React 19, Tailwind, Zustand, React Flow
- Multi-provider AI system (DashScope, Kling, MiniMax, Volcengine, OpenAI, etc.)
- All HTTP clients migrated from sync requests to async httpx
- Admin-managed API keys via environment variables
- SSRF vulnerability fixed in ensure_url()
2026-04-29 01:20:12 +08:00

43 lines
1.1 KiB
Python

"""add provider to tasks
Revision ID: add_provider_to_tasks
Revises: bfac9b8e32f5
Create Date: 2024-02-11
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'add_provider_to_tasks'
down_revision = 'bfac9b8e32f5'
branch_labels = None
depends_on = None
def upgrade() -> None:
"""Add provider column to tasks table"""
# Add provider column (nullable, indexed)
op.add_column('tasks', sa.Column('provider', sa.String(), nullable=True))
# Create index on provider column for faster queries
op.create_index(op.f('ix_tasks_provider'), 'tasks', ['provider'], unique=False)
# Optional: Migrate existing data by extracting provider from params
# This is a data migration that can be run separately if needed
op.execute("""
UPDATE tasks
SET provider = params->>'provider'
WHERE params->>'provider' IS NOT NULL
""")
def downgrade() -> None:
"""Remove provider column from tasks table"""
# Drop index first
op.drop_index(op.f('ix_tasks_provider'), table_name='tasks')
# Drop column
op.drop_column('tasks', 'provider')