Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

target_metadata = Base.metadata

# Update URL from settings
config.set_main_option("sqlalchemy.url", settings.DATABASE_URL)
# Update URL from settings (use async URL for async migrations)
config.set_main_option("sqlalchemy.url", settings.database_url_async)


def run_migrations_offline() -> None:
Expand Down
2 changes: 1 addition & 1 deletion alembic/versions/002_add_api_key_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# revision identifiers, used by Alembic.
revision = '002_add_api_key_table'
down_revision = '001_initial_schema'
down_revision = '001'
branch_labels = None
depends_on = None

Expand Down
20 changes: 4 additions & 16 deletions alembic/versions/003_add_performance_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,16 @@

def upgrade():
"""Add performance indexes for frequently queried columns."""
# Jobs table indexes
op.create_index(op.f('ix_jobs_api_key'), 'jobs', ['api_key'])
op.create_index(op.f('ix_jobs_status'), 'jobs', ['status'])
# Jobs table indexes (ix_jobs_api_key and ix_jobs_status already exist from 001)
op.create_index(op.f('ix_jobs_created_at'), 'jobs', ['created_at'])
op.create_index(op.f('ix_jobs_status_api_key'), 'jobs', ['status', 'api_key'])
op.create_index(op.f('ix_jobs_api_key_created_at'), 'jobs', ['api_key', 'created_at'])

# API keys table indexes
op.create_index(op.f('ix_api_keys_key_hash'), 'api_keys', ['key_hash'])
op.create_index(op.f('ix_api_keys_is_active'), 'api_keys', ['is_active'])
op.create_index(op.f('ix_api_keys_expires_at'), 'api_keys', ['expires_at'])
# API keys indexes already created in migration 002

def downgrade():
"""Remove performance indexes."""
# Jobs table indexes
# Jobs table indexes (only drop ones added by this migration)
op.drop_index(op.f('ix_jobs_api_key_created_at'), table_name='jobs')
op.drop_index(op.f('ix_jobs_status_api_key'), table_name='jobs')
op.drop_index(op.f('ix_jobs_created_at'), table_name='jobs')
op.drop_index(op.f('ix_jobs_status'), table_name='jobs')
op.drop_index(op.f('ix_jobs_api_key'), table_name='jobs')

# API keys table indexes
op.drop_index(op.f('ix_api_keys_expires_at'), table_name='api_keys')
op.drop_index(op.f('ix_api_keys_is_active'), table_name='api_keys')
op.drop_index(op.f('ix_api_keys_key_hash'), table_name='api_keys')
# API keys indexes managed by migration 002
2 changes: 1 addition & 1 deletion alembic/versions/004_add_job_progress_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# revision identifiers, used by Alembic.
revision: str = '004'
down_revision: Union[str, None] = '003'
down_revision: Union[str, None] = '003_add_performance_indexes'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None

Expand Down
1 change: 1 addition & 0 deletions api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Settings(BaseSettings):
env_file=".env",
env_file_encoding="utf-8",
case_sensitive=False,
extra="ignore", # Ignore extra fields in .env file
)

# Application
Expand Down
6 changes: 3 additions & 3 deletions api/models/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""
from datetime import datetime
from enum import Enum
from typing import Optional, Dict, Any, List, Annotated
from typing import Optional, Dict, Any, List, Annotated, Union
from uuid import UUID, uuid4

from sqlalchemy import Column, String, JSON, DateTime, Float, Integer, Index
Expand Down Expand Up @@ -154,7 +154,7 @@ class ConvertRequest(BaseModel):
)

input: Annotated[
str | Dict[str, Any],
Union[str, Dict[str, Any]],
Field(
description="Input file path or configuration object",
examples=["/storage/input/video.mp4", {"path": "/storage/video.mp4", "backend": "s3"}]
Expand All @@ -163,7 +163,7 @@ class ConvertRequest(BaseModel):
]

output: Annotated[
str | Dict[str, Any],
Union[str, Dict[str, Any]],
Field(
description="Output file path or configuration object",
examples=["/storage/output/video.webm"]
Expand Down