chore: remove { concurrent: true } and comment why

This commit is contained in:
anatawa12 2025-04-30 22:51:20 +09:00
parent 16236fbc80
commit 61cbb1c60b
No known key found for this signature in database
GPG Key ID: 9CA909848B8E4EA6
1 changed files with 4 additions and 2 deletions

View File

@ -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())