summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/App/BorgRestore/DB.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/App/BorgRestore/DB.pm b/lib/App/BorgRestore/DB.pm
index 3d1d6ad..6fb8c7c 100644
--- a/lib/App/BorgRestore/DB.pm
+++ b/lib/App/BorgRestore/DB.pm
@@ -96,6 +96,7 @@ method _migrate() {
$self->{dbh}->do('delete from `files`');
},
};
+ my $ran_migrations = 0;
for my $target_version (sort { $a <=> $b } keys %$schema) {
if ($version < $target_version) {
@@ -105,8 +106,13 @@ method _migrate() {
$self->_set_db_version($target_version);
$self->{dbh}->commit();
$log->debugf("Schema upgrade to version %s complete", $target_version);
+ $ran_migrations = 1;
}
}
+ if ($ran_migrations) {
+ $log->debug("Vacuuming database");
+ $self->{dbh}->do("vacuum");
+ }
}
method _get_db_version() {