anchor.diff:      test_record_upgrade(Config, token, [1, 2]).
   
   
  -test_record_upgrade(Config, Type, Versions) ->
  -    lists:foldl(fun(Version, RecordInOlderVersion) ->
  -        {NewVersion, NewRecord} = oz_test_utils:call_oz(
  -            Config, Type, upgrade_record, [Version - 1, RecordInOlderVersion]
  -        ),
  -        ?assertEqual({NewVersion, NewRecord}, {Version, get_record(Type, Version)}),
  -        NewRecord
  -    end, get_record(Type, hd(Versions)), tl(Versions)).
  +test_record_upgrade(Config, RecordType, Versions) ->
  +    Nodes = ?OZ_NODES(Config),
  +    ok = test_utils:mock_new(Nodes, RecordType, [passthrough]),
  +
  +    % Force saving data to disc
  +    % Due to that record will be upgraded when fetching
  +    MockCtx = #{model => RecordType, memory_driver => undefined},
  +    Key = datastore_utils:gen_key(),
  +
  +    % Simulate record in first version
  +    mock_record_version(Config, RecordType, hd(Versions)),
  +
  +    Doc = #document{
  +        key = Key,
  +        value = get_record(RecordType, hd(Versions))
  +    },
  +    oz_test_utils:call_oz(Config, datastore_model, save, [MockCtx, Doc]),
  +
  +    lists:foreach(fun(Version) ->
  +        % Simulate new record version
  +        mock_record_version(Config, RecordType, Version),
  +
  +        % Fetch record which should cause upgrade to the new version
  +        Result = ?assertMatch({ok, _Doc}, oz_test_utils:call_oz(
  +            Config, datastore_model, get, [MockCtx, Key]
  +        )),
  +        {ok, #document{value = NewRecord}} = Result,
  +
  +        ?assertEqual(NewRecord, get_record(RecordType, Version))
  +    end, tl(Versions)),
  +
  +    test_utils:mock_unload(Nodes, RecordType).
   
   
   %%%===================================================================
  
positive.code: 
  end_per_suite(_Config) ->
      ok.
  
  %%%===================================================================
  %%% Record definitions
  
negative.code: -include_lib("ctool/include/logging.hrl").
  -include_lib("ctool/include/test/assertions.hrl").
  -include_lib("ctool/include/test/performance.hrl").
  
  -define(OZ_NODES(Config), ?config(oz_worker_nodes, Config)).
  
  %% API
  -export([
  