feat: 稼働中DBがsqlite3/pgsqlのどちらかを表示するインジケータ機能 (#67)#68
Merged
Conversation
- GET /api/meta (auth:sanctum) が DB::connection()->getDriverName() を返す - サイドバー下部に DB バッジを表示(sqlite→SQLite / pgsql→PostgreSQL) - local モード(localStorage adapter)は API を呼ばず 'local' 表示 - Feature test: 未認証401 / 認証済みで実ドライバ名を返す(両DBプロファイル対応) - e2e: api モード(api-auth-crud.spec.js)と local モード(db-indicator.spec.js) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
PostgreSQL 移行期間中に環境ごとで SQLite / PostgreSQL が混在しても、ログイン後画面(サイドバー下部)から現在接続中のデータストア種別を判別できるようにするための DB インジケータ機能を追加する PR です。
Changes:
- Backend に
GET /api/meta(auth:sanctum配下)を追加し、解決済み接続の DB ドライバ名を返却 - Frontend の
Layoutサイドバー footer にDbIndicatorを追加し、ドライバ名を人間可読なラベルで表示(失敗時は非表示) - localStorage アダプターでは API を呼ばず
local表示にし、Feature/E2E テストを追加
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| app/Http/Controllers/MetaController.php | 稼働中 DB ドライバ名を返す /api/meta 用コントローラを追加 |
| routes/api.php | auth:sanctum グループ内に GET /api/meta を追加 |
| resources/js/types.ts | フロント側のメタ情報型 SystemMeta を追加 |
| resources/js/data/store.ts | Adapter 型に getSystemMeta() を追加し、store 経由で公開 |
| resources/js/data/adapters/api.ts | API モードで /api/meta を呼ぶ getSystemMeta() を追加 |
| resources/js/data/adapters/local.ts | local モードで db_driver: 'local' を返す getSystemMeta() を追加 |
| resources/js/components/Layout.tsx | サイドバー footer に DbIndicator を追加して表示を実装 |
| tests/Feature/MetaApiTest.php | /api/meta の認証要件と返却値を検証する Feature テストを追加 |
| tests/e2e/api-auth-crud.spec.js | API モードで DB インジケータ表示(SQLite/PostgreSQL)を検証する E2E を追加 |
| tests/e2e/db-indicator.spec.js | local モードで local 表示になることを検証する E2E を追加 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
概要
Closes #67
#62 の PostgreSQL 移行期間中、環境によって SQLite / PostgreSQL が混在するため、画面から接続中の DB を判別できるインジケータをサイドバー下部に追加する。
変更内容
GET /api/meta(auth:sanctum配下)を追加。DB::connection()->getDriverName()の実値(設定値ではなく解決済み接続のドライバ名)を返すMetaControllerを新設Layoutサイドバー下部にDbIndicatorバッジを追加(data-testid="db-indicator")。sqlite →DB: SQLite、pgsql →DB: PostgreSQL、取得失敗時は非表示DB: local(ブラウザ内保存)を表示SystemMetaをtypes.tsに追加し、api / local 両 adapter とstore.tsのAdapter型にgetSystemMetaを追加影響範囲
routes/api.php(auth 配下にエンドポイント1本追加のみ、既存 API は不変)Layout.tsx(サイドバー footer への表示追加のみ)/api/metaは 401(インフラ情報を未認証に露出しない)テスト方法
composer test(sqlite プロファイル): 203 passed(新規MetaApiTest含む)composer run test:pgsql203 passed(db_driver=pgsqlを実測で検証)。本ブランチ単体は main 起点のため pgsql プロファイル未同梱(feat: PostgreSQL移行の第一段階 — 開発環境・migration互換・テストプロファイル (#62) #66 マージ後に CI/ローカルで再実行可能)npm run type-check/npm run build: クリーンnpm run test:e2e: 35 passed — api モード(api-auth-crud.spec.jsに追加、実 DB のドライバ名表示を検証)と local モード(db-indicator.spec.js新規、local表示を検証)🤖 Generated with Claude Code