Fix more import/export tests for backups

This commit is contained in:
Fedor Indutny 2024-09-16 17:40:52 -07:00 committed by GitHub
parent 8dabe4fbe4
commit 84c562d0b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 225 additions and 60 deletions

View file

@ -486,6 +486,7 @@ export const DataWriter: ServerWritableInterface = {
saveBackupCdnObjectMetadata,
createOrUpdateStickerPack,
createOrUpdateStickerPacks,
updateStickerPackStatus,
updateStickerPackInfo,
createOrUpdateSticker,
@ -495,6 +496,7 @@ export const DataWriter: ServerWritableInterface = {
deleteStickerPackReference,
deleteStickerPack,
addUninstalledStickerPack,
addUninstalledStickerPacks,
removeUninstalledStickerPack,
installStickerPack,
uninstallStickerPack,
@ -5236,6 +5238,16 @@ function createOrUpdateStickerPack(
`
).run(payload);
}
function createOrUpdateStickerPacks(
db: WritableDB,
packs: ReadonlyArray<StickerPackType>
): void {
db.transaction(() => {
for (const pack of packs) {
createOrUpdateStickerPack(db, pack);
}
})();
}
function updateStickerPackStatus(
db: WritableDB,
id: string,
@ -5630,6 +5642,16 @@ function addUninstalledStickerPack(
storageNeedsSync: pack.storageNeedsSync ? 1 : 0,
});
}
function addUninstalledStickerPacks(
db: WritableDB,
packs: ReadonlyArray<UninstalledStickerPackType>
): void {
return db.transaction(() => {
for (const pack of packs) {
addUninstalledStickerPack(db, pack);
}
})();
}
function removeUninstalledStickerPack(db: WritableDB, packId: string): void {
db.prepare<Query>(
'DELETE FROM uninstalled_sticker_packs WHERE id IS $id'