code: def downgrade():
      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)
  
      views_integration = db.Integration(
          name="views", data={}, engine="views", company_id=None
      )
      session.add(views_integration)
      session.commit()
  
      predictors = conn.execute(
          text(
              """
          select id, data_integration_ref from predictor
      """
          )
      ).fetchall()
  
      for predictor in predictors:
          data_integration_ref = predictor["data_integration_ref"]
          if data_integration_ref is None:
              continue
          data_integration_ref = json.loads(data_integration_ref)
          data_integration_id = data_integration_ref.get("id")
          if data_integration_ref["type"] == "view":
              data_integration_id = views_integration.id
  
          conn.execute(
              text(
                  """
              update predictor set data_integration_id = :data_integration_id where id = :id
          """
              ),
              {
                  "data_integration_id": data_integration_id,
                  "id": predictor["id"],
              },
          )
  
      with op.batch_alter_table("predictor", schema=None) as batch_op:
          batch_op.create_foreign_key(
              "fk_data_integration_id",
              "integration",
              ["data_integration_id"],
              ["id"],
          )
          batch_op.drop_column("data_integration_ref")
  
imports: import json
  from alembic import op
  import sqlalchemy
  from sqlalchemy.sql import text
  import mindsdb.interfaces.storage.db
label_desc: Use image node_id 2 for calling a global function with example usage: downgrade() without return types