Introduce versioning clock to timer system

This commit is contained in:
Fedor Indutny 2024-08-21 09:03:28 -07:00 committed by GitHub
parent bb1d957e49
commit 2fb50df0af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 703 additions and 28 deletions

View file

@ -0,0 +1,30 @@
// Copyright 2024 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { Database } from '@signalapp/better-sqlite3';
import type { LoggerType } from '../../types/Logging';
export const version = 1150;
export function updateToSchemaVersion1150(
currentVersion: number,
db: Database,
logger: LoggerType
): void {
if (currentVersion >= 1150) {
return;
}
db.transaction(() => {
db.exec(`
-- All future conversations will start from '1'
ALTER TABLE conversations
ADD COLUMN expireTimerVersion INTEGER NOT NULL DEFAULT 1;
-- All current conversations will start from '2'
UPDATE conversations SET expireTimerVersion = 2;
`);
db.pragma('user_version = 1150');
})();
logger.info('updateToSchemaVersion1150: success!');
}