code: def run_migrations(connection: Connection):
      # Temporarily disable foreign keys,
      # so that sqlite batch table migrations are performed without data loss:
      # https://alembic.sqlalchemy.org/en/latest/batch.html#dealing-with-referencing-foreign-keys
      connection.execute(text("PRAGMA foreign_keys=OFF;"))
      connection.commit()
      context.configure(
          connection=connection,
          target_metadata=target_metadata,
          compare_type=True,
          render_as_batch=True,
      )
      with context.begin_transaction():
          context.run_migrations()
      connection.execute(text("PRAGMA foreign_keys=ON;"))
      connection.commit()
  
file_path: dstack/src/dstack/_internal/server/migrations/env.py
imports: import asyncio
  from logging.config import fileConfig
  from alembic import context
  from sqlalchemy import Connection, MetaData, text
  from dstack._internal.server.db import db
  from dstack._internal.server.models import BaseModel
label_desc: Use image node_id 4 for calling a global function with example usage: run_migrations(connection) without return types