Fix: DB CONSTRAINT of RenoteMuting #11724
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Fix: DB CONSTRAINT of RenoteMuting
リノートミュートしているユーザーが削除されてもリノートミュートが壊れないようにします。
現在リノートミュートが導入されていますが、ユーザーIDに対する外部キー制約を設定されていなかったため、リノートミュートされているユーザーが消された場合に、リノートミュートがうまく動かなくなります。
#11398 にて外部キー制約が設定されましたが、以前古いレコードは残ったままであり、このままリリースしてしまうとマイグレーションがエラーとなり通らなくなります。
そのためこのPRにて、外部キー制約を導入するために、事前に該当レコードを削除します。
サブクエリは重くなる可能性がありますが、該当PRのマイグレーションを通すためにはやむを得ません。
またこれは新しいマイグレーションファイルとして用意される必要があります。
なぜならすでにマイグレーションを完了しているインスタンスには同じマイグレーションを適用することはできないからです。
今回と直接関係はないですがリノートミュートのdownメソッドが定義されませんでしたので、これは元のマイグレーションファイルに追記します。
Why
Fix: #11343
Additional info (optional)
Misskey v13.14.2 以降の開発ブランチの開発環境で問題なし

Checklist