From 61cbb1c60bc2390f91fad4492908431c3509623e Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Wed, 30 Apr 2025 22:51:20 +0900 Subject: [PATCH] chore: remove { concurrent: true } and comment why --- packages/backend/src/models/Note.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/models/Note.ts b/packages/backend/src/models/Note.ts index fe499bdc0b..4f8a0f9184 100644 --- a/packages/backend/src/models/Note.ts +++ b/packages/backend/src/models/Note.ts @@ -11,12 +11,14 @@ import { MiChannel } from './Channel.js'; import type { MiDriveFile } from './DriveFile.js'; // Note: When you create a new index for existing column of this table, -// it might be better to index concurrently by setting `{ concurrent: true }`. +// it might be better to index concurrently by editing generated migration file // Since this table is very large, and it takes a long time to create index in most cases. // Please note that `CREATE INDEX CONCURRENTLY` is not supported in transaction, // so you need to set `transaction = false` in migration. // Please refer 1745378064470-composite-note-index.js for example. -@Index(['userId', 'id'], { concurrent: true }) +// You should not use `@Index({ concurrent: true })` decorator because +// it will break database initialization on test, because it will always run CREATE INDEX in transaction. +@Index(['userId', 'id']) @Entity('note') export class MiNote { @PrimaryColumn(id())