feat: CREATE INDEX CONCURRENTLY for "userId" "id" composite note index if admin wish. (#15915)
* chore: CREATE INDEX CONCURRENTLY for "userId" "id" composite note index
* chore: remove { concurrent: true } and comment why
* update comment
* feat: add MISSKEY_MIGRATION_CREATE_INDEX_CONCURRENTLY option
* fix: spdx license header
* alter comment
* chore: improve behavior when migration failure
* docs(changelog): 2025.4.1 で追加されたインデックスの再生成をノートの追加しながら行えるようになりました
* ちょっと表現を変更
---------
Co-authored-by: 饺子w (Yumechi) <35571479+eternal-flame-ad@users.noreply.github.com>
This commit is contained in:
parent
d25af911cf
commit
1af98b690b
6 changed files with 49 additions and 4 deletions
|
|
@ -10,6 +10,16 @@ import { MiUser } from './User.js';
|
|||
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 under isConcurrentIndexMigrationEnabled flag
|
||||
// by editing generated migration file since this table is very large,
|
||||
// and it will make a long lock 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 if isConcurrentIndexMigrationEnabled() is true.
|
||||
// Please refer 1745378064470-composite-note-index.js for example.
|
||||
// You should not use `@Index({ concurrent: true })` decorator because database initialization for test will fail
|
||||
// because it will always run CREATE INDEX in transaction based on decorators.
|
||||
// Not appending `{ concurrent: true }` to `@Index` will not cause any problem in production,
|
||||
@Index(['userId', 'id'])
|
||||
@Entity('note')
|
||||
export class MiNote {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue