summaryrefslogtreecommitdiffstats
path: root/lib/App/BorgRestore/DB.pm
AgeCommit message (Collapse)AuthorFilesLines
2020-10-14DB: Remove columns left over by migrations 3/4Florian Pritz1-0/+24
It's not super bad that these are there, but they do increase the database size a fair bit considering that they are actually just full of NULL values. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2020-10-14DB: Vacuum database after schema migrationsFlorian Pritz1-0/+6
Migrations may remove data and it doesn't hurt to vacuum afterwards to reduce the file size. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2020-09-27Add missing database migrationFlorian Pritz1-0/+7
Should have been part of f0dd3fd59afac321317d3b52a36d179b4ea504f7. Oops. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2020-09-27DB: Fix incorrect subpath handling for path that is a superstring of theFlorian Pritz1-1/+8
previous path Files that share a common substring (e.g. `/home/foo/.ssh/id_rsa` and `/home/foo/.ssh/id_rsa.pub`) could incorrectly trigger an optimization that was only supposed to be triggered if the first path is a directory. The first path would then not be added to the database cache even though it should have been. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2019-09-28Import untaint function where usedFlorian Pritz1-7/+7
Better code readability than with the full name. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2019-09-28Helper: Remove untaint_archive_nameFlorian Pritz1-6/+2
We no longer need a special whitelist for archive names since the database no longer uses them as column keys. We still need to untaint variables that are passed to DBI so we use untaint() for this now. We also move the location of the untaint call closer to its usage with DBI/system() to prevent untainted data from leaking elsewhere. Fixes #4 Signed-off-by: Florian Pritz <bluewind@xinu.at>
2019-09-28DB: Convert timestamp column names to numeric IDsFlorian Pritz1-7/+23
Having the backup archive names in the table columns is not strictly necessary. Replace this with numeric IDs and map them via the `archives` table so that we can eventually remove untaint_archive_name(). Signed-off-by: Florian Pritz <bluewind@xinu.at>
2019-09-28DB: Use get_archive_id instead of _prefix_archive_idFlorian Pritz1-2/+2
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2019-09-28DB: Apply migration is correct orderFlorian Pritz1-1/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2019-09-28DB: Implement version based database schema upgradesFlorian Pritz1-6/+34
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2019-02-07DB/remove_archive: Properly handle cases where the DB is empty after removalFlorian Pritz1-7/+13
Empty here means that the DB does not contain any backup archive information because all information that is already in the db has to be removed. The old code tries to copy existing data into the new table, but since there are no archives to copy data for, the sql query fails. Also, it would copy all rows and only populate the path column, but if there are no archives that have timestamps, that's actually useless work. This patch ensures that the table is kept empty if there are no archives. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2018-09-09DB: Fix update_path_if_greater not working for existing rowsFlorian Pritz1-1/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2018-09-09Use strictures instead of strict/warningsFlorian Pritz1-2/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2018-09-06Add direct-to-db adding of paths instead of memory onlyFlorian Pritz1-3/+13
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2018-08-19Remove unused variableFlorian Pritz1-1/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2018-08-19DB: Do not create directories for special :foo: DBsFlorian Pritz1-1/+4
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2018-08-02Remove sqlite cache size warningFlorian Pritz1-2/+2
The original performance problem on my machine doesn't seem to be reproducable any more so maybe either sqlite got smarter or it was something else entirely. Move the warning to DEBUG and soften the documentation. If it still helps people can use it, but we don't have to annoy them if it doesn't. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2018-01-24Only increase sqlite cache size during updateFlorian Pritz1-4/+7
While not all operations fill the cache, --list does. However, for read operations it doesn't actually appear to help performance. Limit the large cache setting to update operations only because there it does really increase performance. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2018-01-24Add --list feature to search for files contained in backups by pathFlorian Pritz1-0/+16
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2017-12-04Warn if sqlite cache is fullFlorian Pritz1-0/+11
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2017-11-22Create cache directory in DB instead of SettingsFlorian Pritz1-0/+4
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2017-09-25Add missing autodie to packagesFlorian Pritz1-0/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2017-09-10Add basic documentation for all packagesFlorian Pritz1-0/+12
Module::Build::Tiny installs manpages for all packages and for these 3 the manpages were empty. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2017-08-10Bump minimal perl version to 5.14Florian Pritz1-1/+1
Function::Parameters requires >=5.14 so we can bump our version as well. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2017-04-11DB: Fix broken db initializationFlorian Pritz1-1/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2017-04-11DB: Fix opening of missing dbFlorian Pritz1-1/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2017-04-10Remove unused Data::Dumper dependencyFlorian Pritz1-1/+0
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2017-04-10Use Function::Parameters for DB packageFlorian Pritz1-58/+16
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2017-04-02Make sqlite cache size configurableFlorian Pritz1-3/+5
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2017-03-13Refactor db creation and cache dir creationFlorian Pritz1-1/+9
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2017-02-27Remove empty lines from the dbFlorian Pritz1-1/+8
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2017-02-27Move packages to dedicated filesFlorian Pritz1-0/+185
Signed-off-by: Florian Pritz <bluewind@xinu.at>