-- fix database to repair found_in_db bug fixed in r74

--delete from files where id not in (
--	select distinct on(shareid,path,date,size) id
--	from files
--	order by shareid,path,date,size,backupnum asc
--);

-- Below is alternative implementation which seems much faster for me.
-- You must manually COMMIT your transaction to make changes permanent.

begin ;
select distinct on(shareid,path,date,size) id into temp okids from files order by shareid,path,date,size,backupnum asc;
delete from files where id not in (select id from okids) ;
