def METHOD_NAME(apps, schema_editor):
    reportmodel = apps.get_model("reportmanager", "SQLReport")
    columnmodel = apps.get_model("reportmanager", "SQLColumn")
    db = schema_editor.connection.alias
    for rep in reportmodel.objects.all().using(db):
        try:
            with connections[db].cursor() as cursor:
                # The query is wrapped in a dummy filter, to avoid executing the
                # inner real query. It still generates the list of all columns.
                cursor.execute("select * from (%s) as Q where false" % rep.sql)
                seq = 1
                for f in cursor.description:
                    if f[1] == 1700:
                        fmt = "number"
                    elif f[1] == 1184:
                        fmt = "datetime"
                    elif f[1] == 23:
                        fmt = "integer"
                    elif f[1] == 1186:
                        fmt = "duration"
                    elif f[1] == 1043:
                        fmt = "text"
                    else:
                        fmt = "character"
                    columnmodel(report=rep, sequence=seq, name=f[0], format=fmt).save(
                        using=db
                    )
                    seq += 1
        except Exception:
            print("Error migrating report %s" % rep.name)