add index for user_id column on highlight table
This commit is contained in:
@ -459,16 +459,19 @@ describe('Highlights API', () => {
|
|||||||
const label1 = await createLabel(labelName1, '#ff0001', user.id)
|
const label1 = await createLabel(labelName1, '#ff0001', user.id)
|
||||||
|
|
||||||
// save labels in highlights
|
// save labels in highlights
|
||||||
await saveLabelsInHighlight([label], existingHighlights[0].id, user.id)
|
await saveLabelsInHighlight(
|
||||||
await saveLabelsInHighlight([label1], existingHighlights[1].id, user.id)
|
[label, label1],
|
||||||
|
existingHighlights[0].id,
|
||||||
|
user.id
|
||||||
|
)
|
||||||
|
|
||||||
const res = await graphqlRequest(query, authToken, {
|
const res = await graphqlRequest(query, authToken, {
|
||||||
query: `label:"${labelName}" label:"${labelName1}"`,
|
query: `label:"${labelName}" label:"${labelName1}"`,
|
||||||
}).expect(200)
|
}).expect(200)
|
||||||
const highlights = res.body.data.highlights.edges as Array<HighlightEdge>
|
const highlights = res.body.data.highlights.edges as Array<HighlightEdge>
|
||||||
expect(highlights).to.have.lengthOf(2)
|
expect(highlights).to.have.lengthOf(1)
|
||||||
expect(highlights[1].node.labels?.[0].name).to.eq(labelName)
|
expect(highlights[0].node.labels?.[0].name).to.eq(labelName)
|
||||||
expect(highlights[0].node.labels?.[0].name).to.eq(labelName1)
|
expect(highlights[0].node.labels?.[1].name).to.eq(labelName1)
|
||||||
|
|
||||||
await deleteLabels([label.id, label1.id], user.id)
|
await deleteLabels([label.id, label1.id], user.id)
|
||||||
})
|
})
|
||||||
|
|||||||
5
packages/db/migrations/0178.do.add_index_on_highlight_user_id.sql
Executable file
5
packages/db/migrations/0178.do.add_index_on_highlight_user_id.sql
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
-- Type: DO
|
||||||
|
-- Name: add_index_on_highlight_user_id
|
||||||
|
-- Description: Add index on user_id column to the highlight table
|
||||||
|
|
||||||
|
CREATE INDEX CONCURRENTLY IF NOT EXISTS highlight_user_id_idx ON omnivore.highlight (user_id);
|
||||||
9
packages/db/migrations/0178.undo.add_index_on_highlight_user_id.sql
Executable file
9
packages/db/migrations/0178.undo.add_index_on_highlight_user_id.sql
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
-- Type: UNDO
|
||||||
|
-- Name: add_index_on_highlight_user_id
|
||||||
|
-- Description: Add index on user_id column to the highlight table
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
DROP INDEX IF EXISTS highlight_user_id_idx;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
Reference in New Issue
Block a user