Use @signalapp/sqlcipher

This commit is contained in:
Fedor Indutny
2025-03-12 14:45:54 -07:00
committed by GitHub
parent df7997b313
commit 5a9253bd44
118 changed files with 2497 additions and 1485 deletions

View File

@@ -6,7 +6,7 @@ import { v4 as generateGuid } from 'uuid';
import type { WritableDB, ReadableDB, MessageType } from '../../sql/Interface';
import { sql, jsonToObject } from '../../sql/util';
import { createDB, insertData, updateToVersion } from './helpers';
import { createDB, insertData, updateToVersion, explain } from './helpers';
import type { MessageAttributesType } from '../../model-types';
import { DurationInSeconds } from '../../util/durations/duration-in-seconds';
@@ -43,7 +43,7 @@ export function getMostRecentAddressableNondisappearingMessages(
LIMIT ${limit};
`;
const rows = db.prepare(query).all(parameters);
const rows = db.prepare(query).all<{ json: string }>(parameters);
return rows.map(row => jsonToObject(row.json));
}
@@ -159,10 +159,9 @@ describe('SQL/updateToSchemaVersion1080', () => {
});
it('ensures that index is used for getMostRecentAddressableNondisappearingMessagesSync, with storyId', () => {
const { detail } = db
.prepare(
`
EXPLAIN QUERY PLAN
const detail = explain(
db,
sql`
SELECT json FROM messages
INDEXED BY messages_by_date_addressable_nondisappearing
WHERE
@@ -172,8 +171,7 @@ describe('SQL/updateToSchemaVersion1080', () => {
ORDER BY received_at DESC, sent_at DESC
LIMIT 5;
`
)
.get();
);
assert.notInclude(detail, 'B-TREE');
assert.notInclude(detail, 'SCAN');