code: def upgrade():
      # In alembic >= 1.7.0, `table_args` is unnecessary since CHECK constraints are preserved
      # during migrations.
      table_args = (
          []
          if Version(alembic.__version__) >= Version("1.7.0")
          else check_constraint_table_args
      )
      with op.batch_alter_table(
          "runs", table_args=table_args
      ) as batch_op:
          # Transform the "status" column to an `Enum` and define a new check constraint. Specify
          # `native_enum=False` to create a check constraint rather than a
          # database-backend-dependent enum (see https://docs.sqlalchemy.org/en/13/core/
          # type_basics.html#sqlalchemy.types.Enum.params.native_enum)
          batch_op.alter_column(
              "status",
              type_=Enum(
                  *new_run_statuses,
                  create_constraint=True,
                  native_enum=False,
              ),
              existing_type=Enum(
                  *old_run_statuses,
                  create_constraint=True,
                  native_enum=False,
                  name="status",
              ),
          )
  
file_path: mlflow/mlflow/store/db_migrations/versions/cfd24bdc0731_update_run_status_constraint_with_killed.py
imports: import alembic
  from alembic import op
  from packaging.version import Version
  from sqlalchemy import CheckConstraint, Enum
  from mlflow.entities import RunStatus, ViewType
  from mlflow.entities.lifecycle_stage import LifecycleStage
  from mlflow.store.tracking.dbmodels.models import SqlRun, SourceTypes
label_desc: Use image node_id 1 for calling a global function with example usage: upgrade() without return types