Only create call links from storage sync after refresh confirmed

This commit is contained in:
ayumi-signal 2024-10-15 11:49:32 -07:00 committed by GitHub
parent 86abb43aec
commit 568c09c579
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 169 additions and 46 deletions

View file

@ -0,0 +1,35 @@
// 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';
import { sql } from '../util';
export const version = 1240;
export function updateToSchemaVersion1240(
currentVersion: number,
db: Database,
logger: LoggerType
): void {
if (currentVersion >= 1240) {
return;
}
db.transaction(() => {
const [createTable] = sql`
CREATE TABLE defunctCallLinks (
roomId TEXT NOT NULL PRIMARY KEY,
rootKey BLOB NOT NULL,
adminKey BLOB
) STRICT;
`;
db.exec(createTable);
db.pragma('user_version = 1240');
})();
logger.info('updateToSchemaVersion1240: success!');
}

View file

@ -99,10 +99,11 @@ import { updateToSchemaVersion1190 } from './1190-call-links-storage';
import { updateToSchemaVersion1200 } from './1200-attachment-download-source-index';
import { updateToSchemaVersion1210 } from './1210-call-history-started-id';
import { updateToSchemaVersion1220 } from './1220-blob-sessions';
import { updateToSchemaVersion1230 } from './1230-call-links-admin-key-index';
import {
updateToSchemaVersion1230,
updateToSchemaVersion1240,
version as MAX_VERSION,
} from './1230-call-links-admin-key-index';
} from './1240-defunct-call-links-table';
function updateToSchemaVersion1(
currentVersion: number,
@ -2071,6 +2072,7 @@ export const SCHEMA_VERSIONS = [
updateToSchemaVersion1210,
updateToSchemaVersion1220,
updateToSchemaVersion1230,
updateToSchemaVersion1240,
];
export class DBVersionFromFutureError extends Error {