backup serving, storing and restoring

This commit is contained in:
Julian Krauser 2025-02-02 16:23:44 +01:00
parent fc01263c4e
commit 6330ebd01d
8 changed files with 261 additions and 3 deletions

View file

@ -96,6 +96,8 @@ export default abstract class BackupHelper {
}
FileSystemHelper.writeFile(path, filename + ".json", JSON.stringify(json, null, 2));
// TODO: delete older backups by copies env
}
static async loadBackup({
@ -114,6 +116,10 @@ export default abstract class BackupHelper {
let file = FileSystemHelper.readFile(`${path}/${filename}`);
let backup: BackupFileContent = JSON.parse(file);
if ((partial && include.length == 0) || (!partial && include.length != 0)) {
throw new InternalException("partial and include have to be set correctly for restoring backup.");
}
dataSource.manager
.transaction(async (transaction) => {
this.transactionManager = transaction;