Fix messages_unread index
This commit is contained in:
parent
fa8ff2ae4c
commit
a17e157e7b
3 changed files with 61 additions and 0 deletions
|
@ -1324,4 +1324,31 @@ describe('SQL migrations test', () => {
|
|||
assert.notInclude(details, 'SCAN');
|
||||
});
|
||||
});
|
||||
|
||||
describe('updateToSchemaVersion49', () => {
|
||||
it('creates usable index for messages_unread', () => {
|
||||
updateToVersion(50);
|
||||
|
||||
const details = db
|
||||
.prepare(
|
||||
`
|
||||
EXPLAIN QUERY PLAN
|
||||
SELECT * FROM messages WHERE
|
||||
conversationId = 'conversation' AND
|
||||
readStatus = 'something' AND
|
||||
isStory IS 0 AND
|
||||
storyId IS NULL
|
||||
ORDER BY received_at ASC, sent_at ASC
|
||||
LIMIT 1;
|
||||
`
|
||||
)
|
||||
.all()
|
||||
.map(({ detail }) => detail)
|
||||
.join('\n');
|
||||
|
||||
assert.include(details, 'USING INDEX messages_unread');
|
||||
assert.notInclude(details, 'TEMP B-TREE');
|
||||
assert.notInclude(details, 'SCAN');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue