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
41 changes: 40 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,51 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}

tbls:
services:
mariadb:
image: mariadb:10.6.4
env:
MYSQL_ROOT_PASSWORD: pass
MYSQL_DATABASE: trap_collection
TZ: Asia/Tokyo
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -h 127.0.0.1 -ppass"
--health-interval 10s
--health-start-period 10s
--health-timeout 5s
--health-retries 10

Comment on lines 159 to +175
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot May 5, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Health-check --health-retries 1000 is excessively high — a DB startup failure would block for ~16 minutes.

At --health-interval 1s × 1000 retries, the job won't give up for roughly 16 minutes if the container never becomes healthy. The migrate-lint job uses --health-retries 10 (with --health-interval 10s and a --health-start-period). Bringing tbls in line prevents silent stalls.

🐛 Proposed fix — align with migrate-lint health-check tuning
       options: >-
         --health-cmd "mysqladmin ping -h 127.0.0.1 -ppass"
-        --health-interval 1s
-        --health-timeout 5m
-        --health-retries 1000
+        --health-interval 10s
+        --health-start-period 10s
+        --health-timeout 5s
+        --health-retries 10
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
tbls:
services:
mariadb:
image: mariadb:10.6.4
env:
MYSQL_ROOT_PASSWORD: pass
MYSQL_DATABASE: trap_collection
TZ: Asia/Tokyo
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -h 127.0.0.1 -ppass"
--health-interval 1s
--health-timeout 5m
--health-retries 1000
tbls:
services:
mariadb:
image: mariadb:10.6.4
env:
MYSQL_ROOT_PASSWORD: pass
MYSQL_DATABASE: trap_collection
TZ: Asia/Tokyo
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -h 127.0.0.1 -ppass"
--health-interval 10s
--health-start-period 10s
--health-timeout 5s
--health-retries 10
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yaml around lines 159 - 174, The tbls mariadb service
health-check is set to an excessively high retry count; in the mariadb service
options block (service name "mariadb" under "tbls") replace "--health-retries
1000" with a realistic value such as "--health-retries 10" and align the timing
with migrate-lint by changing "--health-interval 1s" to "--health-interval 10s"
and adding a "--health-start-period 30s" (or similar start-period) so the job
fails fast on real failures instead of waiting ~16 minutes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

妥当な指摘だと思うので対応をお願いします

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@mathsuky ご確認ありがとうございます! tbls ジョブの health-check パラメータを migrate-lint ジョブに合わせて修正します。

  • .github/workflows/ci.yamltbls ジョブの mariadb サービスの health-check オプションを migrate-lint ジョブと同様の設定に変更する

Failed to handle agent chat message. Please try again.


name: tbls
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: go.mod

- name: Install Atlas
run: |
curl -sSf https://atlasgo.sh | sh -s -- --community --yes

- name: Run migration
run: |
until mysqladmin ping -h 127.0.0.1 -ppass --silent; do
echo "Waiting for database to be healthy..."
sleep 1
done

atlas migrate apply \
--config file://atlas.ci.hcl \
--env ci
shell: bash

- name: Run tbls
run: docker compose -f docker/tbls/compose.yaml up --build --abort-on-container-exit
run: |
TBLS_DSN=mariadb://root:pass@127.0.0.1:3306/trap_collection \
go tool tbls doc --rm-dist

- name: Check diff
run: |
Expand Down
5 changes: 5 additions & 0 deletions atlas.ci.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ env "local" {

env "ci" {
dev = "mysql://root:pass@localhost:3306/trap_collection"
url = "mysql://root:pass@localhost:3306/trap_collection"

migration {
dir = "file://migrations"
}

lint {
git {
Expand Down
58 changes: 58 additions & 0 deletions dbdoc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# trap_collection

## Tables

| Name | Columns | Comment | Type |
| ---- | ------- | ------- | ---- |
| [access_tokens](access_tokens.md) | 6 | | BASE TABLE |
| [admins](admins.md) | 1 | | BASE TABLE |
| [atlas_schema_revisions](atlas_schema_revisions.md) | 12 | | BASE TABLE |
| [editions](editions.md) | 5 | | BASE TABLE |
| [edition_game_version_relations](edition_game_version_relations.md) | 2 | | BASE TABLE |
| [feedback_questions](feedback_questions.md) | 7 | | BASE TABLE |
| [games](games.md) | 7 | | BASE TABLE |
| [game_creators](game_creators.md) | 5 | | BASE TABLE |
| [game_creator_custom_jobs](game_creator_custom_jobs.md) | 4 | | BASE TABLE |
| [game_creator_custom_job_relations](game_creator_custom_job_relations.md) | 2 | | BASE TABLE |
| [game_creator_jobs](game_creator_jobs.md) | 3 | | BASE TABLE |
| [game_creator_job_relations](game_creator_job_relations.md) | 2 | | BASE TABLE |
| [game_feedbacks](game_feedbacks.md) | 4 | | BASE TABLE |
| [game_feedback_answers](game_feedback_answers.md) | 4 | | BASE TABLE |
| [game_feedback_configs](game_feedback_configs.md) | 2 | | BASE TABLE |
| [game_files](game_files.md) | 6 | | BASE TABLE |
| [game_file_types](game_file_types.md) | 3 | | BASE TABLE |
| [game_genres](game_genres.md) | 3 | | BASE TABLE |
| [game_genre_relations](game_genre_relations.md) | 2 | | BASE TABLE |
| [game_images](game_images.md) | 4 | | BASE TABLE |
| [game_image_types](game_image_types.md) | 3 | | BASE TABLE |
| [game_management_roles](game_management_roles.md) | 3 | | BASE TABLE |
| [game_management_role_types](game_management_role_types.md) | 3 | | BASE TABLE |
| [game_play_logs](game_play_logs.md) | 9 | | BASE TABLE |
| [game_urls](game_urls.md) | 4 | | BASE TABLE |
| [game_versions](game_versions.md) | 5 | | BASE TABLE |
| [game_version_game_file_relations](game_version_game_file_relations.md) | 2 | | BASE TABLE |
| [game_videos](game_videos.md) | 4 | | BASE TABLE |
| [game_video_types](game_video_types.md) | 3 | | BASE TABLE |
| [game_visibility_types](game_visibility_types.md) | 3 | | BASE TABLE |
| [launcher_sessions](launcher_sessions.md) | 6 | | BASE TABLE |
| [launcher_users](launcher_users.md) | 5 | | BASE TABLE |
| [launcher_versions](launcher_versions.md) | 5 | | BASE TABLE |
| [launcher_version_game_relations](launcher_version_game_relations.md) | 2 | | BASE TABLE |
| [migrations](migrations.md) | 1 | | BASE TABLE |
| [product_keys](product_keys.md) | 5 | | BASE TABLE |
| [product_key_statuses](product_key_statuses.md) | 3 | | BASE TABLE |
| [seats](seats.md) | 2 | | BASE TABLE |
| [seat_statuses](seat_statuses.md) | 3 | | BASE TABLE |
| [v2_game_files](v2_game_files.md) | 6 | | BASE TABLE |
| [v2_game_images](v2_game_images.md) | 4 | | BASE TABLE |
| [v2_game_versions](v2_game_versions.md) | 8 | | BASE TABLE |
| [v2_game_videos](v2_game_videos.md) | 4 | | BASE TABLE |
| [v2_latest_game_version_times](v2_latest_game_version_times.md) | 3 | | BASE TABLE |

## Relations

![er](schema.svg)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
14 changes: 6 additions & 8 deletions docs/db_schema/access_tokens.md → dbdoc/access_tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

## Description

アクセストークンテーブル(v2)

<details>
<summary><strong>Table Definition</strong></summary>

Expand All @@ -28,12 +26,12 @@ CREATE TABLE `access_tokens` (

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| id | varchar(36) | | false | | | アクセストークンUUID |
| product_key_id | varchar(36) | | false | | [product_keys](product_keys.md) | プロダクトキーUUID |
| access_token | varchar(64) | | false | | | アクセストークンの値 |
| expires_at | datetime | | false | | | 有効期限 |
| created_at | datetime | current_timestamp() | false | | | 作成日時 |
| deleted_at | datetime | NULL | true | | | revokeされた日時 |
| id | varchar(36) | | false | | | |
| product_key_id | varchar(36) | | false | | [product_keys](product_keys.md) | |
| access_token | varchar(64) | | false | | | |
| expires_at | datetime | | false | | | |
| created_at | datetime | current_timestamp() | false | | | |
| deleted_at | datetime | NULL | true | | | |

## Constraints

Expand Down
72 changes: 72 additions & 0 deletions dbdoc/access_tokens.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
26 changes: 26 additions & 0 deletions dbdoc/admins.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ CREATE TABLE `atlas_schema_revisions` (
| Name | Type | Definition |
| ---- | ---- | ---------- |
| PRIMARY | PRIMARY KEY | PRIMARY KEY (version) |
| partial_hashes | CHECK | CHECK (json_valid(`partial_hashes`)) |

## Indexes

Expand Down
59 changes: 59 additions & 0 deletions dbdoc/atlas_schema_revisions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading