def migrate_executions(start_dt: datetime.datetime, end_dt: datetime.datetime) -> None:
    """
    Perform migrations for execution related objects (ActionExecutionDB, LiveActionDB).
    """
    print("Migrating execution objects")

    # NOTE: We first only retrieve the IDs because there could be a lot of objects in the database
    # and this could result in massive ram use. Technically, mongoengine loads querysets lazily,
    # but this is not always the case so it's better to first retrieve all the IDs and then retrieve
    # objects one by one.
    # Keep in mind we need to use ModelClass.objects and not PersistanceClass.query() so .only()
    # works correctly - with PersistanceClass.query().only() all the fields will still be retrieved.

    # 1. Migrate ActionExecutionDB objects
    result = (
        ActionExecutionDB.objects(
            __raw__={
                "result": {
                    "$not": {
                        "$type": "binData",
                    },
                },
                "status": {
                    "$in": LIVEACTION_COMPLETED_STATES,
                },
            },
            start_timestamp__gte=start_dt,
            start_timestamp__lte=end_dt,
        )
        .only("id")
        .as_pymongo()
    )
    execution_ids = set([str(item["_id"]) for item in result])
    objects_count = result.count()

    if not execution_ids:
        print("Found no ActionExecutionDB objects to migrate.")
        print("")
        return None

    print("Will migrate %s ActionExecutionDB objects" % (objects_count))
    print("")

    for index, execution_id in enumerate(execution_ids, 1):
        try:
            execution_db = ActionExecution.get_by_id(execution_id)
        except StackStormDBObjectNotFoundError:
            print(
                "Skipping ActionExecutionDB with id %s which is missing in the database"
                % (execution_id)
            )
            continue

        print(
            "[%s/%s] Migrating ActionExecutionDB with id %s"
            % (index, objects_count, execution_id)
        )

        # This is a bit of a "hack", but it's the easiest way to tell mongoengine that a specific
        # field has been updated and should be saved. If we don't do, nothing will be re-saved on
        # .save() call due to mongoengine only trying to save what has changed to make it more
        # efficient instead of always re-saving the whole object.
        execution_db._mark_as_changed("result")
        execution_db._mark_as_changed("result_size")

        # We need to explicitly set result_size attribute since Document.save() code path doesn't
        # populate it (but other code paths we utilize elsewhere do).
        # Technically we could do it on document clean() / validate() method, but we don't want that
        # since execution update code in action runner and elsewhere is optimized to make partial
        # updates more efficient.
        result_size = len(
            ActionExecutionDB.result._serialize_field_value(execution_db.result or {})
        )
        execution_db.result_size = result_size

        # NOTE: If you want to view changed fields, you can access execution_db._changed_fields

        execution_db.save()
        print("ActionExecutionDB with id %s has been migrated" % (execution_db.id))

        # Migrate corresponding LiveAction object
        liveaction = execution_db.liveaction or {}
        liveaction_id = liveaction.get("id", None)

        if not liveaction_id:
            continue

        liveaction_db = None
        try:
            liveaction_db = LiveAction.get_by_id(liveaction_id)
        except StackStormDBObjectNotFoundError:
            # If liveaction for some reason doesn't exist (would likely represent corrupted data) we
            # simply ignore that error since it's not fatal.
            print(
                "Skipping LiveActionDB with id %s which is missing in the database"
                % (liveaction_db)
            )
            continue

        liveaction_db._mark_as_changed("result")

        liveaction_db.save()
        print("Related LiveActionDB with id %s has been migrated" % (liveaction_db.id))
        print("")

    Perform migrations for execution related objects (ActionExecutionDB, LiveActionDB).
    
st2common/bin/migrations/v3.5/st2_migrate_db_dict_field_values.py