anchor.diff:                                    {error, term()}.
   delete_sandbox(SandboxId) when is_binary(SandboxId) ->
       delete_object(delete_sandbox_by_id, SandboxId).
  -
   
   %% Checksum Operations
   
  
positive.code: 
  -export([fetch_user/1,
           %% checksum ops
           mark_checksums_as_uploaded/2,
           non_uploaded_checksums/2,
  
  
negative.code: -spec delete_checksums(OrgId::binary(),
                         CookbookVersionId::binary()) -> {ok, 1 } | {error, _}.
  delete_checksums(OrgId, CookbookVersionId) ->
      % retrieve a list of checksums before we delete the
      % cookbook_version_checksums record
      Checksums = fetch_cookbook_version_checksums(OrgId, CookbookVersionId),
      case sqerl:statement(delete_cookbook_checksums_by_orgid_cookbook_versionid,
                           [OrgId, CookbookVersionId]) of
          {ok, N} when is_integer(N) -> %% pretend there is 1
              delete_checksums(Checksums);
          {ok, none} ->
              %% this is ok, there might be no checksums to delete
              delete_checksums(Checksums);
          {error, Error} ->
              {error, Error}
      end.
  
  %% @doc Deletes a list of checksums from the checksums table.  Happily swallows
  %% foreign_key constraint errors assuming the checksum is still associated with
  %% another cookbook_version_checksum record.  Returns a list of deleted checksum
  %% ids for further upstream processing(ie delete the checksums from S3).
  delete_checksums(Checksums) ->
      DeletedChecksums = lists:foldl(fun(Checksum, Acc) ->
                              case sqerl:statement(delete_checksum_by_id, [Checksum]) of
                                  {ok, N} when is_integer(N) -> %% pretend there is 1
                                      [Checksum|Acc];
                                  {foreign_key, _} ->
                                      %% The checksum may still be associated with
                                      %% another cookbook version record which is OK!
                                      Acc;
                                  {error, _Error} ->
                                      Acc
                              end
                        end,
                        [],
                        Checksums),
      {ok, lists:reverse(DeletedChecksums)}.
  
  %% @doc try and delete the row from cookbooks table.  It is protected by a
  %% ON DELETE RESTRICT from cookbook_versions so we get a FK violation if there
  