anchor.diff:      create_design_doc(DbName, <<"_design/foo">>, <<"bar">>),
       DbName.
   
  +setup_legacy() ->
  +    DbName = <<"test">>,
  +    DbFileName = "test.couch",
  +    OldDbFilePath = filename:join([?FIXTURESDIR, DbFileName]),
  +    OldViewName = "3b835456c235b1827e012e25666152f3.view",
  +    FixtureViewFilePath = filename:join([?FIXTURESDIR, OldViewName]),
  +    NewViewName = "6cf2c2f766f87b618edf6630b00f8736.view",
  +
  +    DbDir = config:get("couchdb", "database_dir"),
  +    ViewDir = config:get("couchdb", "view_index_dir"),
  +    OldViewFilePath = filename:join([ViewDir, ".test_design", OldViewName]),
  +    NewViewFilePath = filename:join([ViewDir, ".test_design", "mrview",
  +                                     NewViewName]),
  +
  +    NewDbFilePath = filename:join([DbDir, DbFileName]),
  +
  +    Files = [NewDbFilePath, OldViewFilePath, NewViewFilePath],
  +
  +    %% make sure there is no left over
  +    lists:foreach(fun(File) -> file:delete(File) end, Files),
  +
  +    % copy old db file into db dir
  +    {ok, _} = file:copy(OldDbFilePath, NewDbFilePath),
  +
  +    % copy old view file into view dir
  +    ok = filelib:ensure_dir(OldViewFilePath),
  +
  +    {ok, _} = file:copy(FixtureViewFilePath, OldViewFilePath),
  +
  +    {DbName, Files}.
  +
   teardown({DbName, _}) ->
       teardown(DbName);
   teardown(DbName) when is_binary(DbName) ->
       couch_server:delete(DbName, [?ADMIN_CTX]),
       ok.
   
  +teardown_legacy({_DbName, Files}) ->
  +    lists:foreach(fun(File) -> file:delete(File) end, Files).
   
   view_indexes_cleanup_test_() ->
       {
  
positive.code:             couch_mrview_index, DbName, <<"_design/foo">>),
          ?assert(is_pid(IndexerPid)),
          ?assert(is_process_alive(IndexerPid)),
          ?assertEqual(2, count_db_refs(DbName)),
  
          create_doc(DbName, "doc1001"),
          Rows0 = query_view(DbName, "foo", "bar"),
          check_rows_value(Rows0, null),
          ?assertEqual(4, length(Rows0)),
          ?assertEqual(2, count_db_refs(DbName)),
          ?assert(is_process_alive(IndexerPid)),
  
          update_design_doc(DbName,  <<"_design/foo">>, <<"bar">>),
  
negative.code:     couch_file:close(Fd),
      Header.
  
  stop_indexer(StopFun, Pid, Line, Reason) ->
      case test_util:stop_sync(Pid, StopFun) of
      timeout ->
          erlang:error(
              {assertion_failed,
               [{module, ?MODULE}, {line, Line},
                {reason, Reason}]});
      ok ->
          ok
      end.
  
  wait_indexer(IndexerPid) ->
      test_util:wait(fun() ->
          {ok, Info} = couch_index:get_info(IndexerPid),
          case couch_util:get_value(compact_running, Info) of
              true ->
                  wait;
              false ->
                  ok
          end
      end).
  