added some useful SQL examples. They are lightly commented within each file.
authordpavlin <dpavlin@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Fri, 26 Aug 2005 20:44:24 +0000 (20:44 +0000)
committerdpavlin <dpavlin@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Fri, 26 Aug 2005 20:44:24 +0000 (20:44 +0000)
git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/BackupPC/trunk@75 8392b6e1-25fa-0310-8288-cc32f8e212ea

sql/backups.sql [new file with mode: 0644]
sql/fix_found_in_db.sql [new file with mode: 0644]

diff --git a/sql/backups.sql b/sql/backups.sql
new file mode 100644 (file)
index 0000000..e03417c
--- /dev/null
@@ -0,0 +1,12 @@
+-- report number of files in each backup
+
+select
+       shares.name,
+       hosts.name,
+       backupnum,
+       count(*)
+from files
+join shares on shareid=shares.id
+join hosts on hostid = hosts.id
+group by shares.name, hosts.name, backupnum
+order by hosts.name, shares.name, backupnum;
diff --git a/sql/fix_found_in_db.sql b/sql/fix_found_in_db.sql
new file mode 100644 (file)
index 0000000..c0e69fb
--- /dev/null
@@ -0,0 +1,7 @@
+-- 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
+);