Only create call links from storage sync after refresh confirmed
This commit is contained in:
parent
86abb43aec
commit
568c09c579
9 changed files with 169 additions and 46 deletions
35
ts/sql/migrations/1240-defunct-call-links-table.ts
Normal file
35
ts/sql/migrations/1240-defunct-call-links-table.ts
Normal 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!');
|
||||
}
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue