[初期データ投入] Seederの投入方式を個別チェックに変更し、新規インストール時の問題を解決しました#2295
Merged
masaton0216 merged 5 commits intomasterfrom Oct 29, 2025
Merged
[初期データ投入] Seederの投入方式を個別チェックに変更し、新規インストール時の問題を解決しました#2295masaton0216 merged 5 commits intomasterfrom
masaton0216 merged 5 commits intomasterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
概要
背景
マイグレーションでConfigsテーブルにレコードを生成すると、新規インストール時に
DefaultConfigsTableSeederの基本設定投入がスキップされ、システムが正常動作しない問題がありました(Issue #2293)。原因は
if (Configs::count() == 0)という条件により、Configsテーブルに1件でもレコードが存在すると16項目の基本設定が投入されない仕様でした。目的
変更内容
1.
database/seeders/DefaultConfigsTableSeeder.phpのリファクタリング:if (Configs::count() == 0)による一括insert(16項目)を廃止where('name', '項目名')->count() == 0)に変更$configsを削除し、コードスタイルを統一2. パフォーマンス最適化
3. コード品質向上
4. 包括的なテストの追加
tests/Unit/Database/Seeders/DefaultConfigsTableSeederTest.phpを新規作成:
テスト結果: 全8テストケースがパス ✅
技術的な改善ポイント
Before (最初の改善版)
After (最適化版)
効果
これにより、マイグレーションでConfigsレコードが先に作成されても、各設定項目は個別に存在チェックされ、不足している項目だけが投入されます。
レビュー完了希望日
不具合対応なので急ぎたいです
関連Pull requests/Issues
2025_10_29_000000_remove_mail_auth_method_from_migration.php参考
2021_01_16_094533_additional_configs_move_from_migration_to_seeder.phpDB変更の有無
無し
チェックリスト