Handle PniChangeNumber
This commit is contained in:
parent
412f07d2a2
commit
79b48115e6
32 changed files with 1086 additions and 485 deletions
38
ts/sql/migrations/64-uuid-column-for-pre-keys.ts
Normal file
38
ts/sql/migrations/64-uuid-column-for-pre-keys.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Copyright 2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { Database } from 'better-sqlite3';
|
||||
|
||||
import type { LoggerType } from '../../types/Logging';
|
||||
|
||||
export default function updateToSchemaVersion64(
|
||||
currentVersion: number,
|
||||
db: Database,
|
||||
logger: LoggerType
|
||||
): void {
|
||||
if (currentVersion >= 64) {
|
||||
return;
|
||||
}
|
||||
|
||||
db.transaction(() => {
|
||||
db.exec(
|
||||
`
|
||||
ALTER TABLE preKeys
|
||||
ADD COLUMN ourUuid STRING
|
||||
GENERATED ALWAYS AS (json_extract(json, '$.ourUuid'));
|
||||
|
||||
CREATE INDEX preKeys_ourUuid ON preKeys (ourUuid);
|
||||
|
||||
ALTER TABLE signedPreKeys
|
||||
ADD COLUMN ourUuid STRING
|
||||
GENERATED ALWAYS AS (json_extract(json, '$.ourUuid'));
|
||||
|
||||
CREATE INDEX signedPreKeys_ourUuid ON signedPreKeys (ourUuid);
|
||||
`
|
||||
);
|
||||
|
||||
db.pragma('user_version = 64');
|
||||
})();
|
||||
|
||||
logger.info('updateToSchemaVersion64: success!');
|
||||
}
|
|
@ -39,6 +39,7 @@ import updateToSchemaVersion60 from './60-update-expiring-index';
|
|||
import updateToSchemaVersion61 from './61-distribution-list-storage';
|
||||
import updateToSchemaVersion62 from './62-add-urgent-to-send-log';
|
||||
import updateToSchemaVersion63 from './63-add-urgent-to-unprocessed';
|
||||
import updateToSchemaVersion64 from './64-uuid-column-for-pre-keys';
|
||||
|
||||
function updateToSchemaVersion1(
|
||||
currentVersion: number,
|
||||
|
@ -1941,6 +1942,7 @@ export const SCHEMA_VERSIONS = [
|
|||
updateToSchemaVersion61,
|
||||
updateToSchemaVersion62,
|
||||
updateToSchemaVersion63,
|
||||
updateToSchemaVersion64,
|
||||
];
|
||||
|
||||
export function updateSchema(db: Database, logger: LoggerType): void {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue