fix: mysql transactions do not work with run property of sqlite (#1974)

* fix: mysql transactions do not work with run property of sqlite

* fix: ci issues
This commit is contained in:
Meier Lukas
2025-01-17 12:53:01 +01:00
committed by GitHub
parent 7622f0a4d2
commit a1084f91e5
9 changed files with 677 additions and 267 deletions

View File

@@ -1,4 +1,4 @@
import { inArray } from "@homarr/db";
import { handleTransactionsAsync, inArray } from "@homarr/db";
import type { Database } from "@homarr/db";
import { apps } from "@homarr/db/schema";
import type { OldmarrConfig } from "@homarr/old-schema";
@@ -31,6 +31,12 @@ export const importSingleOldmarrConfigAsync = async (
const boardInsertCollection = createBoardInsertCollection({ preparedApps, preparedBoards }, settings);
// Due to a limitation with better-sqlite it's only possible to use it synchronously
boardInsertCollection.insertAll(db);
await handleTransactionsAsync(db, {
async handleAsync(db) {
await boardInsertCollection.insertAllAsync(db);
},
handleSync(db) {
boardInsertCollection.insertAll(db);
},
});
};