code: def upgrade():
      """Apply Increase length of ``Flask-AppBuilder`` ``ab_view_menu.name`` column"""
      conn = op.get_bind()
      inspector = inspect(conn)
      tables = inspector.get_table_names()
  
      if "ab_view_menu" in tables:
          if conn.dialect.name == "sqlite":
              op.execute("PRAGMA foreign_keys=off")
              op.execute(
                  """
              CREATE TABLE IF NOT EXISTS ab_view_menu_dg_tmp
              (
                  id INTEGER NOT NULL PRIMARY KEY,
                  name VARCHAR(250) NOT NULL UNIQUE
              );
              """
              )
              op.execute(
                  "INSERT INTO ab_view_menu_dg_tmp(id, name) select id, name from ab_view_menu;"
              )
              op.execute("DROP TABLE ab_view_menu")
              op.execute(
                  "ALTER TABLE ab_view_menu_dg_tmp rename to ab_view_menu;"
              )
              op.execute("PRAGMA foreign_keys=on")
          else:
              op.alter_column(
                  table_name="ab_view_menu",
                  column_name="name",
                  type_=StringID(length=250),
                  nullable=False,
              )
  
imports: from __future__ import annotations
  import sqlalchemy
  from alembic import op
  from sqlalchemy import inspect
  from airflow.migrations.db_types import StringID
label_desc: Use image node_id 1 for calling a global function with example usage: upgrade() without return types