Update db user_version within transaction

This commit is contained in:
Fedor Indutny 2024-08-13 10:52:21 -07:00 committed by GitHub
parent 36db532f31
commit 3a631a587f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 32 additions and 30 deletions

View file

@ -22,6 +22,7 @@ export function updateToSchemaVersion1020(
if (ourAci == null) {
logger.info('updateToSchemaVersion1020: not linked');
db.pragma('user_version = 1020');
return;
}
@ -32,6 +33,7 @@ export function updateToSchemaVersion1020(
const ourConversationId = db.prepare(selectQuery).pluck().get(selectParams);
if (ourConversationId == null) {
logger.error('updateToSchemaVersion1020: no conversation');
db.pragma('user_version = 1020');
return;
}
@ -45,9 +47,9 @@ export function updateToSchemaVersion1020(
if (changes !== 0) {
logger.warn(`updateToSchemaVersion1020: removed ${changes} self merges`);
}
})();
db.pragma('user_version = 1020');
db.pragma('user_version = 1020');
})();
logger.info('updateToSchemaVersion1020: success!');
}