code: def migrate_db(
      revision: Optional[str] = typer.Option(
          default="head", help="DB Revision to migrate to"
      )
  ):
      current_revision = utils.get_current_revision(ALEMBIC_CONFIG_FILE)
      revision = TAGGED_REVISIONS.get(revision, revision)
  
      if revision and current_revision:
          script = ScriptDirectory.from_config(
              Config(ALEMBIC_CONFIG_FILE)
          )
  
          try:
              script.walk_revisions(
                  base=current_revision, head=revision
              ).__next__()
              action = "upgrade"
          except CommandError:
              action = "downgrade"
  
      else:
          revision = revision or "head"
          action = "upgrade"
  
      alembic_args = ["-c", ALEMBIC_CONFIG_FILE, action, revision]
      typer.echo(f"command: alembic {' '.join(alembic_args)}")
  
      alembic.config.main(argv=alembic_args)
  
file_path: argilla/src/argilla/server/cli/database/migrate.py
imports: from typing import Optional
  import alembic
  import typer
  from alembic.config import Config
  from alembic.script import ScriptDirectory
  from alembic.util import CommandError
  from argilla.cli import typer_ext
  from argilla.server.database import ALEMBIC_CONFIG_FILE, TAGGED_REVISIONS
  from .None import utils
label_desc: Use image node_id 1 for calling a global function with example usage: migrate_db(revision) without return types