Update better-sqlite3 and remove FTS optimization

This commit is contained in:
Fedor Indutny 2023-09-01 00:33:31 +02:00 committed by GitHub
parent 77b799c7b0
commit f3eee779a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 39 additions and 141 deletions

View file

@ -0,0 +1,30 @@
// Copyright 2023 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 = 930;
export function updateToSchemaVersion930(
currentVersion: number,
db: Database,
logger: LoggerType
): void {
if (currentVersion >= 930) {
return;
}
db.transaction(() => {
db.exec(`
INSERT INTO messages_fts
(messages_fts, rank)
VALUES
('secure-delete', 1);
`);
db.pragma('user_version = 930');
})();
logger.info('updateToSchemaVersion930: success!');
}

View file

@ -66,10 +66,11 @@ import updateToSchemaVersion88 from './88-service-ids';
import updateToSchemaVersion89 from './89-call-history';
import updateToSchemaVersion90 from './90-delete-story-reply-screenshot';
import updateToSchemaVersion91 from './91-clean-keys';
import { updateToSchemaVersion920 } from './920-clean-more-keys';
import {
version as MAX_VERSION,
updateToSchemaVersion920,
} from './920-clean-more-keys';
updateToSchemaVersion930,
} from './930-fts5-secure-delete';
function updateToSchemaVersion1(
currentVersion: number,
@ -2010,6 +2011,7 @@ export const SCHEMA_VERSIONS = [
updateToSchemaVersion91,
// From here forward, all migrations should be multiples of 10
updateToSchemaVersion920,
updateToSchemaVersion930,
];
export function updateSchema(db: Database, logger: LoggerType): void {