Introduce versioning clock to timer system
This commit is contained in:
parent
bb1d957e49
commit
2fb50df0af
34 changed files with 703 additions and 28 deletions
30
ts/sql/migrations/1150-expire-timer-version.ts
Normal file
30
ts/sql/migrations/1150-expire-timer-version.ts
Normal 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!');
|
||||
}
|
|
@ -90,10 +90,11 @@ import { updateToSchemaVersion1100 } from './1100-optimize-mark-call-history-rea
|
|||
import { updateToSchemaVersion1110 } from './1110-sticker-local-key';
|
||||
import { updateToSchemaVersion1120 } from './1120-messages-foreign-keys-indexes';
|
||||
import { updateToSchemaVersion1130 } from './1130-isStory-index';
|
||||
import { updateToSchemaVersion1140 } from './1140-call-links-deleted-column';
|
||||
import {
|
||||
updateToSchemaVersion1140,
|
||||
updateToSchemaVersion1150,
|
||||
version as MAX_VERSION,
|
||||
} from './1140-call-links-deleted-column';
|
||||
} from './1150-expire-timer-version';
|
||||
|
||||
function updateToSchemaVersion1(
|
||||
currentVersion: number,
|
||||
|
@ -2052,6 +2053,7 @@ export const SCHEMA_VERSIONS = [
|
|||
updateToSchemaVersion1120,
|
||||
updateToSchemaVersion1130,
|
||||
updateToSchemaVersion1140,
|
||||
updateToSchemaVersion1150,
|
||||
];
|
||||
|
||||
export class DBVersionFromFutureError extends Error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue