Call link call history

This commit is contained in:
ayumi-signal 2024-04-01 12:19:35 -07:00 committed by GitHub
parent ed940f6f83
commit 00d6379bae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 1124 additions and 204 deletions

View file

@ -0,0 +1,40 @@
// 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 = 1010;
export function updateToSchemaVersion1010(
currentVersion: number,
db: Database,
logger: LoggerType
): void {
if (currentVersion >= 1010) {
return;
}
db.transaction(() => {
const [createTable] = sql`
CREATE TABLE callLinks (
roomId TEXT NOT NULL PRIMARY KEY,
rootKey BLOB NOT NULL,
adminKey BLOB,
name TEXT NOT NULL,
-- Enum which stores CallLinkRestrictions from ringrtc
restrictions INTEGER NOT NULL,
revoked INTEGER NOT NULL,
expiration INTEGER
) STRICT;
`;
db.exec(createTable);
db.pragma('user_version = 1010');
})();
logger.info('updateToSchemaVersion1010: success!');
}

View file

@ -75,10 +75,11 @@ import { updateToSchemaVersion960 } from './960-untag-pni';
import { updateToSchemaVersion970 } from './970-fts5-optimize';
import { updateToSchemaVersion980 } from './980-reaction-timestamp';
import { updateToSchemaVersion990 } from './990-phone-number-sharing';
import { updateToSchemaVersion1000 } from './1000-mark-unread-call-history-messages-as-unseen';
import {
version as MAX_VERSION,
updateToSchemaVersion1000,
} from './1000-mark-unread-call-history-messages-as-unseen';
updateToSchemaVersion1010,
} from './1010-call-links-table';
function updateToSchemaVersion1(
currentVersion: number,
@ -2021,6 +2022,7 @@ export const SCHEMA_VERSIONS = [
updateToSchemaVersion980,
updateToSchemaVersion990,
updateToSchemaVersion1000,
updateToSchemaVersion1010,
];
export class DBVersionFromFutureError extends Error {