def METHOD_NAME(
    apps: StateApps, schema_editor: BaseDatabaseSchemaEditor
) -> None:
    RealmEmoji = apps.get_model("zerver", "RealmEmoji")
    uploader = get_uploader()
    for realm_emoji in RealmEmoji.objects.all():
        old_file_name = realm_emoji.file_name
        new_file_name = get_emoji_file_name(old_file_name, str(realm_emoji.id))
        uploader.ensure_emoji_images(realm_emoji.realm_id, old_file_name, new_file_name)
        realm_emoji.file_name = new_file_name
        realm_emoji.save(update_fields=["file_name"])