Source: immutable lab5 snapshot f88e9ba43cdfd7eb6a5a7ae5feb4247b4e820071; forward the allowed diff from 64d5c67. Carry SQLAlchemy, Alembic, reliability fixes, versioned jobs, infrastructure and student tests without changing protected coursework files.
Validation: make check, validate, lint; 515 student tests passed with one Linux-only skip; public smoke with telemetry enabled and repeat migration passed. Stop the owned stack and retain volumes. Preserve the existing OTel work in progress; grade implementation remains a separate phase.
21 lines
427 B
Python
21 lines
427 B
Python
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision = "0005_failed_registry"
|
|
down_revision = "0004_jobs"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_index(
|
|
"jobs_failed_idx",
|
|
"jobs",
|
|
[sa.column("updated_at").desc()],
|
|
postgresql_where=sa.column("status") == "failed",
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("jobs_failed_idx", table_name="jobs")
|