From: dpavlin Date: Thu, 25 Jan 2007 09:27:20 +0000 (+0000) Subject: fix empty backups X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;ds=sidebyside;h=85b4963cdb6d224b524741989ed4082e19b02a5d;p=BackupPC.git fix empty backups git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/BackupPC/trunk@367 8392b6e1-25fa-0310-8288-cc32f8e212ea --- diff --git a/sql/zz_fix_empty_backups.sql b/sql/zz_fix_empty_backups.sql new file mode 100644 index 0000000..bc3a159 --- /dev/null +++ b/sql/zz_fix_empty_backups.sql @@ -0,0 +1,16 @@ +begin; + +-- make temporary table with all backup ids +select backups.id into temporary all_backup_ids from files +join shares on files.shareid = shares.id +join backups on backups.hostid = shares.hostid and backups.num = files.backupnum +where files.shareid = shares.id +group by backups.id, files.shareid, files.backupnum +; + +-- fix backups which are deleted and have size anyway +update backups set inc_deleted = false where id not in (select id from all_backup_ids) and size > 0 ; + +-- fix parts numbering + +update backups set parts = 0 where parts > 0 and id not in (select backup_id from backup_parts) ;