Files
app/backend/fluksio/alembic/versions/c4e9a2f7b318_run_external_id.py
T
stroblme af18d134a4 Add POST /runs/import for runs executed elsewhere
A history recorded before the move (MLflow experiments) had nowhere to
go, since runs were only made by running a flow. Each entry is stored as
it ended: parameters completed and checked like a submit, cause
"import", empty commit and code digest, metrics and artifacts written
as given, nothing queued or announced. Run.external_id (new migration)
makes a second import a no-op and is an export column so a row joins
back. The request is all or nothing and capped at 200 entries;
Client.import_runs pages a longer history.
2026-09-16 17:01:07 +02:00

39 lines
931 B
Python

"""run.external_id
Runs were only ever made by running a flow, so a history recorded somewhere
else before the move had nowhere to go. An imported run keeps the id it had
there, and the unique index is what makes importing it twice a no-op.
Revision ID: c4e9a2f7b318
Revises: a8f6f79e40be
Create Date: 2026-09-16
"""
import sqlalchemy as sa
import sqlmodel.sql.sqltypes
from alembic import op
# revision identifiers, used by Alembic.
revision = "c4e9a2f7b318"
down_revision = "a8f6f79e40be"
branch_labels = None
depends_on = None
def upgrade():
op.add_column(
"run",
sa.Column(
"external_id",
sqlmodel.sql.sqltypes.AutoString(length=255),
nullable=True,
),
)
op.create_index("ix_run_external_id", "run", ["external_id"], unique=True)
def downgrade():
op.drop_index("ix_run_external_id", table_name="run")
op.drop_column("run", "external_id")