code: def upgrade():
      with op.batch_alter_table("predictor", schema=None) as batch_op:
          batch_op.add_column(
              sa.Column(
                  "data_integration_id", sa.Integer(), nullable=True
              )
          )
  
      conn = op.get_bind()
      session = sa.orm.Session(bind=conn)
      result = conn.execute(
          text(
              """
          select 1 from integration where name = 'lightwood';
      """
          )
      ).fetchall()
      if len(result) == 0:
          conn.execute(
              text(
                  """
              insert into integration (name, engine, data)
              values ('lightwood', 'lightwood', '{}')
          """
              )
          )
      conn.execute(
          text(
              """
          update predictor set data_integration_id = integration_id
          where exists (select 1 from integration where integration.id = predictor.integration_id);
      """
          )
      )
      conn.execute(
          text(
              """
          update predictor set integration_id = (select id from integration where name = 'lightwood');
      """
          )
      )
      session.commit()
  
      with op.batch_alter_table("predictor", schema=None) as batch_op:
          batch_op.alter_column(
              "integration_id",
              existing_type=sa.INTEGER(),
              nullable=False,
          )
          batch_op.create_foreign_key(
              "fk_data_integration_id",
              "integration",
              ["data_integration_id"],
              ["id"],
          )
  
imports: from alembic import op
  import sqlalchemy
  from sqlalchemy.sql import text
  import mindsdb.interfaces.storage.db
label_desc: Use image node_id 1 for calling a global function with example usage: upgrade() without return types