GeoIntel release gates / Compile, test, contracts and builds (push) Successful in 1m49s
GeoIntel release gates / Python and npm vulnerability policy (push) Successful in 21s
GeoIntel release gates / Production AI image, SBOM and container scan (push) Successful in 5m39s
GeoIntel release gates / Deploy exact gated revision to Unraid (push) Failing after 58m43s
39 lines
1.7 KiB
Python
39 lines
1.7 KiB
Python
"""Add lightweight job table for sprint-3 async architecture foundation."""
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
revision = "20260611212435"
|
|
down_revision = "202601120001"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"jobs",
|
|
sa.Column("id", sa.UUID(as_uuid=True), primary_key=True),
|
|
sa.Column("job_type", sa.Text(), nullable=False),
|
|
sa.Column("status", sa.Text(), nullable=False, server_default="queued"),
|
|
sa.Column("project_id", sa.UUID(as_uuid=True), sa.ForeignKey("projects.id", ondelete="CASCADE"), nullable=False),
|
|
sa.Column("dataset_id", sa.UUID(as_uuid=True), sa.ForeignKey("datasets.id", ondelete="SET NULL"), nullable=True),
|
|
sa.Column("input_dataset_id", sa.UUID(as_uuid=True), sa.ForeignKey("datasets.id", ondelete="SET NULL"), nullable=True),
|
|
sa.Column("output_dataset_id", sa.UUID(as_uuid=True), sa.ForeignKey("datasets.id", ondelete="SET NULL"), nullable=True),
|
|
sa.Column("parameters_json", sa.JSON(), nullable=False),
|
|
sa.Column("result_json", sa.JSON(), nullable=True),
|
|
sa.Column("error_message", sa.Text(), nullable=True),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("NOW()")),
|
|
sa.Column("started_at", sa.DateTime(timezone=True), nullable=True),
|
|
sa.Column("finished_at", sa.DateTime(timezone=True), nullable=True),
|
|
)
|
|
|
|
op.create_index("ix_jobs_project_id", "jobs", ["project_id"])
|
|
op.create_index("ix_jobs_status", "jobs", ["status"])
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ix_jobs_status", table_name="jobs")
|
|
op.drop_index("ix_jobs_project_id", table_name="jobs")
|
|
op.drop_table("jobs")
|