]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/updatedb/update_sqlite_tables_6_to_7
Try to fix bug #2349 multiple recycle messages
[bacula/bacula] / bacula / updatedb / update_sqlite_tables_6_to_7
index 3b5edd7d868be28e6fe1f5b96c6ecd62baa8eb25..f5ad8884b19fc0b2eb44f1dc2b7eb07525b9ce84 100755 (executable)
@@ -13,6 +13,18 @@ bindir=/usr/lib/sqlite
 # The location of your bacula working directory
 cd /var/bacula
 
+if [ -s bacula.db ];then
+        DB_VER=`echo "select * from Version;" | $bindir/sqlite bacula.db | tail -n 1 2>/dev/null`
+        if [ -n "$DB_VER" ] && [ "$DB_VER" -ne "6" ]; then
+                echo "Sorry, this script is designed to update a version 6 database"
+                echo "and you have a version $DB_VER database."
+                exit 1
+        fi
+else
+        echo "Sorry, I can't seem to locate a bacula database."
+        exit 1
+fi
+
 $bindir/sqlite $* bacula.db <<END-OF-DATA
 
 BEGIN TRANSACTION;
@@ -100,7 +112,7 @@ INSERT INTO Media (
    VolRetention, VolUseDuration, MaxVolJobs,
    MaxVolFiles, MaxVolBytes,
    InChanger, MediaAddressing,
-   VolReadTime, VolWriteTime,
+   VolReadTime, VolWriteTime)
    SELECT * FROM Media_backup;
 
 DROP TABLE Media_backup;