forkey/packages/backend/migration/1736888704471-NoteUserIdIdIndex.js
sugar 93dba136ab
Some checks failed
Lint / pnpm_install (pull_request) Successful in 2m14s
Test (backend) / unit (22.x) (pull_request) Successful in 7m8s
Test (backend) / e2e (22.x) (pull_request) Failing after 9m26s
Test (frontend) / vitest (22.x) (pull_request) Successful in 3m0s
Test (production install and build) / production (22.x) (pull_request) Successful in 2m37s
Test (backend) / validate-api-json (22.x) (pull_request) Successful in 3m16s
Lint / lint (backend) (pull_request) Successful in 3m1s
Lint / lint (frontend) (pull_request) Successful in 9m53s
Lint / lint (misskey-js) (pull_request) Successful in 2m22s
Lint / lint (sw) (pull_request) Successful in 3m24s
Lint / typecheck (backend) (pull_request) Successful in 3m17s
Lint / typecheck (misskey-js) (pull_request) Successful in 2m22s
Replace notes(userId) index with (userId, id)
This improves performance of queries searching posts by a given user,
optionally with a provided range of dates, and then using ORDER BY to
sort posts by date.

Examples of such queries include: viewing posts by a given user, as
well as checking when the last post by a given user was written for
Mastodon API.
2025-01-17 15:29:08 +00:00

11 lines
312 B
JavaScript

export class NoteUserIdIdIndex1736888704471 {
name = 'NoteUserIdIdIndex1736888704471'
async up(queryRunner) {
await queryRunner.query(`CREATE INDEX "IDX_note_userId_id" ON "note" ("userId", "id") `);
}
async down(queryRunner) {
await queryRunner.query(`DROP INDEX "public"."IDX_note_userId_id"`);
}
}