Conversation
uchida189
left a comment
There was a problem hiding this comment.
生成は良さそう!
余計なファイルが多いから、そこだけいい感じにしたい!
…ine ER diagram extraction
…and exclude specific files
|
ER図だけコマンド打ったら残るように変更しました で試してみてください |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughSchemaSpy を導入して ER 図を生成する機能を追加しました:Compose サービス(mac 含む)と Makefile ターゲットを追加し、出力先・README・ Changes
Sequence Diagram(s)sequenceDiagram
actor 開発者 as 開発者
participant Make as Makefile
participant DC as DockerCompose
participant SS as SchemaSpyコンテナ
participant DB as PostgreSQL
participant FS as ファイルシステム
開発者->>Make: make schemaspy / make mac-schemaspy を実行
Make->>DC: docker compose run --rm schemaspy
DC->>SS: コンテナ起動 (env, mount を渡す)
SS->>DB: DBへ接続 (host/port/db/user/password, schema)
SS->>FS: /output に ER 図 (PNG 等) を出力 (api/docs/schemaspy)
Make->>FS: 生成画像をフィルタして api/docs/er-diagrams/ と summary/ にコピー
Make-->>開発者: "ER diagrams saved to api/docs/er-diagrams/"
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
Makefile (1)
88-109: Refactor duplicated SchemaSpy targets into one parameterized recipe.Both targets repeat the same body; this already trips checkmake’s max body-length warning and makes future fixes easy to miss in one target.
♻️ Example refactor
+.PHONY: schemaspy mac-schemaspy _schemaspy-run + schemaspy: - mkdir -p api/docs/schemaspy - docker compose run --rm schemaspy - mkdir -p api/docs/er-diagrams/summary - find api/docs/schemaspy/diagrams -name '*.png' ! -name 'relationships.real.*' -exec cp {} api/docs/er-diagrams/ \; - cp api/docs/schemaspy/diagrams/summary/relationships.real.compact.png api/docs/er-diagrams/summary/ - cp api/docs/schemaspy/diagrams/summary/relationships.real.large.png api/docs/er-diagrams/summary/ - rm -rf api/docs/schemaspy - `@echo` "ER diagrams saved to api/docs/er-diagrams/" + $(MAKE) _schemaspy-run COMPOSE_ARGS="" .PHONY: mac-schemaspy mac-schemaspy: - mkdir -p api/docs/schemaspy - docker compose run --rm schemaspy - mkdir -p api/docs/er-diagrams/summary - find api/docs/schemaspy/diagrams -name '*.png' ! -name 'relationships.real.*' -exec cp {} api/docs/er-diagrams/ \; - cp api/docs/schemaspy/diagrams/summary/relationships.real.compact.png api/docs/er-diagrams/summary/ - cp api/docs/schemaspy/diagrams/summary/relationships.real.large.png api/docs/er-diagrams/summary/ - rm -rf api/docs/schemaspy - `@echo` "ER diagrams saved to api/docs/er-diagrams/" + $(MAKE) _schemaspy-run COMPOSE_ARGS="-f docker-compose.mac.yml" + +_schemaspy-run: + mkdir -p api/docs/schemaspy + docker compose $(COMPOSE_ARGS) run --rm schemaspy + mkdir -p api/docs/er-diagrams/summary + find api/docs/schemaspy/diagrams -name '*.png' ! -name 'relationships.real.*' -exec cp {} api/docs/er-diagrams/ \; + cp api/docs/schemaspy/diagrams/summary/relationships.real.compact.png api/docs/er-diagrams/summary/ + cp api/docs/schemaspy/diagrams/summary/relationships.real.large.png api/docs/er-diagrams/summary/ + rm -rf api/docs/schemaspy + `@echo` "ER diagrams saved to api/docs/er-diagrams/"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Makefile` around lines 88 - 109, The two PHONY targets schemaspy and mac-schemaspy duplicate the same recipe; refactor by centralizing the body into a single parameterized target (e.g., schemaspy) and make mac-schemaspy a thin wrapper that invokes it with a variable (e.g., PLATFORM=mac or USE_MAC=1) or by using a generic pattern rule so the shared steps (mkdir, docker compose run, find/cp, cleanup, echo) live only once; update the Makefile so mac-schemaspy simply delegates to schemaspy (passing the variable) and remove the duplicated block to satisfy checkmake and keep future changes in one place.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.coderabbit.yaml:
- Line 3: The reviews.profile entry uses an invalid enum value "concise"; update
the reviews.profile key in .coderabbit.yaml (the profile value) to one of the
allowed values ("chill" or "assertive") so the file passes schema
validation—replace "concise" with the correct option that matches the intended
behavior.
In @.gitignore:
- Around line 31-32: The .gitignore currently ignores "schemaspy/" at repo root
but not the actual generated temp directory "api/docs/schemaspy"; update
.gitignore to ignore the real path used by SchemaSpy (e.g., add
"api/docs/schemaspy/" or a more general pattern like "**/schemaspy/") so the
generated artifacts under api/docs/schemaspy are consistently ignored; ensure
you reference the existing "schemaspy/" entry and remove or keep it as redundant
if you add a recursive pattern.
In `@docker-compose.mac.yml`:
- Around line 46-61: The schemaspy service is always started in
docker-compose.mac.yml; match docker-compose.yml by gating the schemaspy service
behind the tools profile so it’s tool-scoped only. Update the schemaspy service
block (service name "schemaspy") to include a service-level profiles key (e.g.,
profiles: ["tools"]) so it only runs when the tools profile is selected, keeping
the existing environment, volumes and command intact.
In `@Makefile`:
- Around line 99-103: The mac-schemaspy Makefile target is invoking docker
compose without specifying the mac-specific compose file; update the
mac-schemaspy target (target name mac-schemaspy) so the compose command
explicitly uses the mac file (e.g., change the command to use docker compose -f
docker-compose.mac.yml run --rm schemaspy or otherwise pass the mac compose file
via -f) so it runs against docker-compose.mac.yml; keep the existing mkdir steps
intact.
In `@README.md`:
- Around line 45-55: Update the README to correct the persisted output
directory: replace references to `api/docs/schemaspy` with the actual final
artifact location `api/docs/er-diagrams/`, and clarify that running the `make
schemaspy` (and `make mac-schemaspy`) target removes the temporary
`api/docs/schemaspy` folder and writes the final ER diagram artifacts to
`api/docs/er-diagrams/`; keep mention that connection/auth overrides still come
from the compose env vars (`SCHEMASPY_HOST`, `SCHEMASPY_DB`, etc.).
---
Nitpick comments:
In `@Makefile`:
- Around line 88-109: The two PHONY targets schemaspy and mac-schemaspy
duplicate the same recipe; refactor by centralizing the body into a single
parameterized target (e.g., schemaspy) and make mac-schemaspy a thin wrapper
that invokes it with a variable (e.g., PLATFORM=mac or USE_MAC=1) or by using a
generic pattern rule so the shared steps (mkdir, docker compose run, find/cp,
cleanup, echo) live only once; update the Makefile so mac-schemaspy simply
delegates to schemaspy (passing the variable) and remove the duplicated block to
satisfy checkmake and keep future changes in one place.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 44863e92-10f9-4160-805b-c0a2d1671d04
📒 Files selected for processing (6)
.coderabbit.yaml.gitignoreMakefileREADME.mddocker-compose.mac.ymldocker-compose.yml
| .PHONY: mac-schemaspy | ||
| mac-schemaspy: | ||
| mkdir -p api/docs/schemaspy | ||
| docker compose run --rm schemaspy | ||
| mkdir -p api/docs/er-diagrams/summary |
There was a problem hiding this comment.
mac-schemaspy is using the wrong Compose file.
Line 102 runs against the default compose file, so make mac-schemaspy does not actually use docker-compose.mac.yml.
🔧 Proposed fix
.PHONY: mac-schemaspy
mac-schemaspy:
mkdir -p api/docs/schemaspy
- docker compose run --rm schemaspy
+ docker compose -f docker-compose.mac.yml run --rm schemaspy
mkdir -p api/docs/er-diagrams/summary
find api/docs/schemaspy/diagrams -name '*.png' ! -name 'relationships.real.*' -exec cp {} api/docs/er-diagrams/ \;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Makefile` around lines 99 - 103, The mac-schemaspy Makefile target is
invoking docker compose without specifying the mac-specific compose file; update
the mac-schemaspy target (target name mac-schemaspy) so the compose command
explicitly uses the mac file (e.g., change the command to use docker compose -f
docker-compose.mac.yml run --rm schemaspy or otherwise pass the mac compose file
via -f) so it runs against docker-compose.mac.yml; keep the existing mkdir steps
intact.
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (4)
docker-compose.mac.yml (1)
46-61:⚠️ Potential issue | 🟠 Majormac用composeでも
schemaspyを tools プロファイル配下に揃えてください。現状は
docker-compose.mac.ymlだけ通常起動に混ざる構成で、docker-compose.ymlと挙動がズレています。🔧 修正案
schemaspy: container_name: nutfes-seeft-schemaspy image: schemaspy/schemaspy:latest @@ volumes: - ./api/docs/schemaspy:/output + profiles: + - tools command:🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docker-compose.mac.yml` around lines 46 - 61, サービス定義「schemaspy」が通常起動側に残っているので、docker-compose.mac.yml の schemaspy サービスをツール群と同じプロファイルに移動するために、schemaspy サービスブロックに profiles: ["tools"] を追加して通常起動から切り離してください(サービス名: schemaspy、既存の depends_on、environment、volumes、command はそのまま維持してください)。これで docker-compose.yml と同様に tools プロファイル経由で起動されるようになります。README.md (1)
45-45:⚠️ Potential issue | 🟡 Minor永続化される出力先の説明が実装とずれています。
Line 45 の記載は一時出力先です。最終生成物は
api/docs/er-diagrams/に保存され、api/docs/schemaspyは処理後に削除されます。📝 修正案
-- 生成物の出力先: `api/docs/schemaspy` +- 最終生成物の出力先: `api/docs/er-diagrams/` +- 一時出力先: `api/docs/schemaspy`(処理後に削除)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@README.md` at line 45, README.md currently states the generated output goes to `api/docs/schemaspy`, but that's a temporary directory; update the documentation text to state the final generated artifacts are saved to `api/docs/er-diagrams/` and clarify that `api/docs/schemaspy` is removed after processing (replace the `api/docs/schemaspy` reference with `api/docs/er-diagrams/` and add a note about the temporary deletion)..gitignore (1)
31-32:⚠️ Potential issue | 🟡 Minor
schemaspy/だと実際の一時出力先を無視できません。Line 32 はリポジトリ直下のみ対象ですが、一時生成先は
api/docs/schemaspyです(Makefile Line 90, Line 96)。失敗時の生成物取りこぼしを防ぐため、実パスを無視対象にしてください。🔧 修正案
# SchemaSpy -schemaspy/ +api/docs/schemaspy/🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.gitignore around lines 31 - 32, .gitignore currently ignores "schemaspy/" which only matches a top-level directory and misses the actual temporary output location; update the ignore entry by replacing or adding the repository-relative directory name used for generated output ("api/docs/schemaspy") so the real temporary generation directory is excluded and generated artifacts aren’t accidentally committed.Makefile (1)
101-102:⚠️ Potential issue | 🟠 Major
mac-schemaspyが mac 用 Compose ファイルを使っていません。Line 102 は通常のデフォルト Compose を参照するため、ターゲット名と実行内容が一致していません。
🔧 修正案
.PHONY: mac-schemaspy mac-schemaspy: mkdir -p api/docs/schemaspy - docker compose run --rm schemaspy + docker compose -f docker-compose.mac.yml run --rm schemaspy mkdir -p api/docs/er-diagrams/summary🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Makefile` around lines 101 - 102, The mac-specific Makefile target mac-schemaspy is calling the default compose file but should use the mac Compose file; update the mac-schemaspy recipe so the docker compose invocation references the mac compose file (e.g. replace the existing docker compose run --rm schemaspy with docker compose -f docker-compose.mac.yml run --rm schemaspy or the appropriate mac-specific -f flags), ensuring the target name mac-schemaspy matches the compose files it runs.
🧹 Nitpick comments (1)
Makefile (1)
88-108:schemaspy系ターゲットの重複は共通化すると保守しやすいです。同一処理が2箇所に分かれており、将来の修正漏れが起きやすいです(今回の mac 側 compose 指定漏れも同系統)。
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Makefile` around lines 88 - 108, The two Makefile targets schemaspy and mac-schemaspy duplicate the same steps; refactor by extracting the common commands into a single reusable target (e.g., schemaspy-common or a phony target named schemaspy) and have mac-schemaspy simply depend on or call that target while only supplying the Mac-specific difference (e.g., additional docker compose flags or COMPOSE_FILE/DOCKER_COMPOSE_OPTS) to docker compose run --rm; update targets schemaspy and mac-schemaspy to call the shared target so changes are maintained in one place and ensure the Mac path passes the correct compose option.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docker-compose.yml`:
- Around line 65-67: The docker-compose depends_on currently uses condition:
service_started which may run SchemaSpy before PostgreSQL is ready; add a
comprehensive healthcheck to the db service (e.g., run pg_isready or equivalent)
and change the SchemaSpy service's depends_on entry from condition:
service_started to condition: service_healthy so SchemaSpy waits until db
reports healthy; target the depends_on block and the db service definition when
implementing the change.
---
Duplicate comments:
In @.gitignore:
- Around line 31-32: .gitignore currently ignores "schemaspy/" which only
matches a top-level directory and misses the actual temporary output location;
update the ignore entry by replacing or adding the repository-relative directory
name used for generated output ("api/docs/schemaspy") so the real temporary
generation directory is excluded and generated artifacts aren’t accidentally
committed.
In `@docker-compose.mac.yml`:
- Around line 46-61: サービス定義「schemaspy」が通常起動側に残っているので、docker-compose.mac.yml の
schemaspy サービスをツール群と同じプロファイルに移動するために、schemaspy サービスブロックに profiles: ["tools"]
を追加して通常起動から切り離してください(サービス名: schemaspy、既存の depends_on、environment、volumes、command
はそのまま維持してください)。これで docker-compose.yml と同様に tools プロファイル経由で起動されるようになります。
In `@Makefile`:
- Around line 101-102: The mac-specific Makefile target mac-schemaspy is calling
the default compose file but should use the mac Compose file; update the
mac-schemaspy recipe so the docker compose invocation references the mac compose
file (e.g. replace the existing docker compose run --rm schemaspy with docker
compose -f docker-compose.mac.yml run --rm schemaspy or the appropriate
mac-specific -f flags), ensuring the target name mac-schemaspy matches the
compose files it runs.
In `@README.md`:
- Line 45: README.md currently states the generated output goes to
`api/docs/schemaspy`, but that's a temporary directory; update the documentation
text to state the final generated artifacts are saved to `api/docs/er-diagrams/`
and clarify that `api/docs/schemaspy` is removed after processing (replace the
`api/docs/schemaspy` reference with `api/docs/er-diagrams/` and add a note about
the temporary deletion).
---
Nitpick comments:
In `@Makefile`:
- Around line 88-108: The two Makefile targets schemaspy and mac-schemaspy
duplicate the same steps; refactor by extracting the common commands into a
single reusable target (e.g., schemaspy-common or a phony target named
schemaspy) and have mac-schemaspy simply depend on or call that target while
only supplying the Mac-specific difference (e.g., additional docker compose
flags or COMPOSE_FILE/DOCKER_COMPOSE_OPTS) to docker compose run --rm; update
targets schemaspy and mac-schemaspy to call the shared target so changes are
maintained in one place and ensure the Mac path passes the correct compose
option.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 14c96444-e794-4a29-82a1-77aa0a829806
📒 Files selected for processing (6)
.coderabbit.yaml.gitignoreMakefileREADME.mddocker-compose.mac.ymldocker-compose.yml
There was a problem hiding this comment.
♻️ Duplicate comments (1)
docker-compose.mac.yml (1)
51-66:⚠️ Potential issue | 🟠 Major
schemaspyをtoolsプロファイル配下に戻してください。mac 側だけ
profilesがないため、通常のupで常時対象になります。docker-compose.ymlと同様にツール用途へ限定した方が安全です。🔧 修正案
schemaspy: container_name: nutfes-seeft-schemaspy image: schemaspy/schemaspy:latest @@ volumes: - ./api/docs/schemaspy:/output + profiles: + - tools command:#!/bin/bash set -euo pipefail echo "=== docker-compose.yml (reference) ===" rg -n -A20 -B2 '^\s*schemaspy:\s*$|^\s*profiles:\s*$|^\s*-\s*tools\s*$' docker-compose.yml echo echo "=== docker-compose.mac.yml (current) ===" rg -n -A20 -B2 '^\s*schemaspy:\s*$|^\s*profiles:\s*$|^\s*-\s*tools\s*$' docker-compose.mac.yml🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docker-compose.mac.yml` around lines 51 - 66, The schemaspy service in docker-compose.mac.yml is currently unconditional and should be limited to the tools profile like in docker-compose.yml; update the schemaspy service definition to include a profiles key with "- tools" (i.e., add profiles: [ "tools" ] or profiles: followed by - tools) so it does not start on a normal docker-compose up on mac, ensuring the service remains accessible under the tools profile only.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@docker-compose.mac.yml`:
- Around line 51-66: The schemaspy service in docker-compose.mac.yml is
currently unconditional and should be limited to the tools profile like in
docker-compose.yml; update the schemaspy service definition to include a
profiles key with "- tools" (i.e., add profiles: [ "tools" ] or profiles:
followed by - tools) so it does not start on a normal docker-compose up on mac,
ensuring the service remains accessible under the tools profile only.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e7d30f8e-aaaf-473d-b31d-46ebea9134ca
📒 Files selected for processing (2)
docker-compose.mac.ymldocker-compose.yml
🚧 Files skipped from review as they are similar to previous changes (1)
- docker-compose.yml
|
将来の更新で SchemaSpy と PostgreSQLが非互換になる可能性があるため、 |
#243
resolve #243
SchemaSpyによるER図導入のタスクに対応
概要
画面スクリーンショット等
URLスクリーンショット
テスト項目
備考
Summary by CodeRabbit
New Features
Documentation
Chores