Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: ja-JP
reviews:
profile: chill
auto_review:
enabled: true
chat:
auto_reply: true
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ api/lib/interface
api/env/*
api/seeds/*
web/prod/*
api/docs/er-diagrams/*

# SchemaSpy
api/docs/schemaspy/
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,29 @@ mac-seed:
sleep 15
docker compose -f docker-compose.mac.yml run --rm api go run /app/seeds/seeds.go

.PHONY: schemaspy
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/"

.PHONY: mac-schemaspy
mac-schemaspy:
mkdir -p api/docs/schemaspy
docker compose run --rm schemaspy
mkdir -p api/docs/er-diagrams/summary
Comment on lines +99 to +103
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

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.

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/"


# mobile/lib/assetsに512*512のアイコンを用意しておくこと(コマンドのファイル名も変更する)
# リサイズ用にImageMagickをインストールする(`sudo apt-get install imagemagick` or `brew install imagemagick`)
.PHONY: mobile-icons-init
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ git submodule update --init
### diを編集してからうまく動かないとき
一度コンテナをdownさせてからupし直してみてください。

## SchemaSpyでDBスキーマを確認する(PostgreSQL)
- DB初期データは `mysql/db` ディレクトリにありますが、実際のDBはPostgreSQLです。
- 最終生成物の出力先: `api/docs/er-diagrams/`
- 一時出力先: `api/docs/schemaspy`(処理後に削除)

```fish
# 標準(docker-compose.yml)
make schemaspy

# Mac用composeを使う場合
make mac-schemaspy
```
接続先・認証情報は compose の環境変数(`SCHEMASPY_HOST`, `SCHEMASPY_DB` など)で上書きできます。

## Author
NUTMEG(技大祭実行委員会情報局)
mail: nutfes.info [at] gmail
40 changes: 39 additions & 1 deletion docker-compose.mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.8"
services:
db:
container_name: nutfes-seeft-db
image: postgres
image: postgres:18
volumes:
- ./mysql/db:/docker-entrypoint-initdb.d/ # 初期データ
- ./my.cnf:/etc/mysql/conf.d/my.cnf
Expand All @@ -12,6 +12,11 @@ services:
POSTGRES_USER: seeft
POSTGRES_PASSWORD: password
TZ: 'Asia/Tokyo'
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 5s
retries: 10
ports:
- 5432:5432

Expand Down Expand Up @@ -43,3 +48,36 @@ services:
tty: true
depends_on: [api]

schemaspy:
container_name: nutfes-seeft-schemaspy
image: schemaspy/schemaspy:latest
depends_on:
db:
condition: service_healthy
environment:
SCHEMASPY_HOST: ${SCHEMASPY_HOST:-db}
SCHEMASPY_PORT: ${SCHEMASPY_PORT:-5432}
SCHEMASPY_DB: ${SCHEMASPY_DB:-seeft_db}
SCHEMASPY_USER: ${SCHEMASPY_USER:-seeft}
SCHEMASPY_PASSWORD: ${SCHEMASPY_PASSWORD:-password}
SCHEMASPY_SCHEMA: ${SCHEMASPY_SCHEMA:-public}
volumes:
- ./api/docs/schemaspy:/output
command:
Comment thread
coderabbitai[bot] marked this conversation as resolved.
- "-t"
- "pgsql"
- "-host"
- "${SCHEMASPY_HOST:-db}"
- "-port"
- "${SCHEMASPY_PORT:-5432}"
- "-db"
- "${SCHEMASPY_DB:-seeft_db}"
- "-u"
- "${SCHEMASPY_USER:-seeft}"
- "-p"
- "${SCHEMASPY_PASSWORD:-password}"
- "-s"
- "${SCHEMASPY_SCHEMA:-public}"
- "-o"
- "/output"

44 changes: 42 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: "3.8"


services:
db:
container_name: nutfes-seeft-db
image: postgres
image: postgres:18
volumes:
- ./mysql/db:/docker-entrypoint-initdb.d/ # 初期データ
- ./my.cnf:/etc/mysql/conf.d/my.cnf
Expand All @@ -12,6 +12,11 @@ services:
POSTGRES_USER: seeft
POSTGRES_PASSWORD: password
TZ: 'Asia/Tokyo'
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 5s
retries: 10
ports:
- 5432:5432

Expand Down Expand Up @@ -59,4 +64,39 @@ services:
tty: true
depends_on: [api]

schemaspy:
container_name: nutfes-seeft-schemaspy
image: schemaspy/schemaspy:latest
depends_on:
db:
condition: service_healthy
environment:
SCHEMASPY_HOST: ${SCHEMASPY_HOST:-db}
SCHEMASPY_PORT: ${SCHEMASPY_PORT:-5432}
SCHEMASPY_DB: ${SCHEMASPY_DB:-seeft_db}
SCHEMASPY_USER: ${SCHEMASPY_USER:-seeft}
SCHEMASPY_PASSWORD: ${SCHEMASPY_PASSWORD:-password}
SCHEMASPY_SCHEMA: ${SCHEMASPY_SCHEMA:-public}
volumes:
- ./api/docs/schemaspy:/output
profiles:
- tools
command:
- "-t"
- "pgsql"
- "-host"
- "${SCHEMASPY_HOST:-db}"
- "-port"
- "${SCHEMASPY_PORT:-5432}"
- "-db"
- "${SCHEMASPY_DB:-seeft_db}"
- "-u"
- "${SCHEMASPY_USER:-seeft}"
- "-p"
- "${SCHEMASPY_PASSWORD:-password}"
- "-s"
- "${SCHEMASPY_SCHEMA:-public}"
# - "-o"
# - "/output"