(apps, schema_editor)
Check if migrated. Raises SystemExit if not migrated
Check if migrated. Raises SystemExit if not migrated
Check if migrated . Raises SystemExit if not migrated
def _assert_blobmetas_migrated(apps, schema_editor):
    """Check if migrated. Raises SystemExit if not migrated"""
    num_attachments = get_num_attachments(schema_editor.connection)

    migrated = num_attachments == 0
    if migrated:
        return

    if num_attachments < 10000:
        try:
            call_command(
                "run_sql",
                "simple_move_form_attachments_to_blobmeta",
                dbname=schema_editor.connection.alias,
            )
            migrated = get_num_attachments(schema_editor.connection) == 0
            if not migrated:
                print("Automatic migration failed")
                migrated = False
        except Exception:
            traceback.print_exc()
    else:
        print("Found %s attachments." % num_attachments)
        print("Too many to migrate automatically.")

    if not migrated:
        print("")
        print(BLOBMETAS_NOT_MIGRATED_ERROR)
        sys.exit(1)
def _assert_blobmetas_migrated ( apps , schema_editor ) : num_attachments = get_num_attachments ( schema_editor . connection ) migrated = num_attachments == 0 if migrated : return if num_attachments < 10000 : try : call_command ( "run_sql" , "simple_move_form_attachments_to_blobmeta" , dbname = schema_editor . connection . alias , ) migrated = get_num_attachments ( schema_editor . connection ) == 0 if not migrated : print ( "Automatic migration failed" ) migrated = False except Exception : traceback . print_exc ( ) else : print ( "Found %s attachments." % num_attachments ) print ( "Too many to migrate automatically." ) if not migrated : print ( "" ) print ( BLOBMETAS_NOT_MIGRATED_ERROR ) sys . exit ( 1 )