Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Add JobMetricsPoint.job_id index

Revision ID: ad8c50120507
Revises: e9d81c97c042
Create Date: 2026-04-03 10:43:18.440334+00:00

"""

from alembic import op

# revision identifiers, used by Alembic.
revision = "ad8c50120507"
down_revision = "e9d81c97c042"
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("job_metrics_points", schema=None) as batch_op:
batch_op.create_index(batch_op.f("ix_job_metrics_points_job_id"), ["job_id"], unique=False)

# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("job_metrics_points", schema=None) as batch_op:
batch_op.drop_index(batch_op.f("ix_job_metrics_points_job_id"))

# ### end Alembic commands ###
2 changes: 1 addition & 1 deletion src/dstack/_internal/server/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ class JobMetricsPoint(BaseModel):
UUIDType(binary=False), primary_key=True, default=uuid.uuid4
)

job_id: Mapped[uuid.UUID] = mapped_column(ForeignKey("jobs.id"))
job_id: Mapped[uuid.UUID] = mapped_column(ForeignKey("jobs.id"), index=True)
job: Mapped["JobModel"] = relationship()

timestamp_micro: Mapped[int] = mapped_column(BigInteger)
Expand Down
Loading