Skip to content

Commit 475c67d

Browse files
suna-bigclaude
andcommitted
feat: add test data insertion script
- Add scripts/insert-test-data.sh for easy test data setup - Insert sample data: 5 genres, 5 series, 3 seasons, 3 episodes - Update README.md with test data insertion instructions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
1 parent a71d35e commit 475c67d

File tree

2 files changed

+65
-1
lines changed

2 files changed

+65
-1
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
# MySQL と Redis を起動
88
$ docker-compose up -d
99

10+
# テストデータを投入(オプション)
11+
$ ./scripts/insert-test-data.sh
12+
1013
# アプリケーションを起動
1114
$ make run-local
1215

@@ -18,4 +21,12 @@ $ docker-compose down
1821
```shell
1922
$ make setup
2023
$ make run-local
21-
```
24+
```
25+
26+
## テストデータについて
27+
28+
`scripts/insert-test-data.sh` を実行すると、以下のテストデータが投入されます:
29+
- 5 genres(アニメ、ドラマ、バラエティ、映画、格闘技)
30+
- 5 series(ONE PIECE、名探偵コナン、ドラゴンボール、NARUTO、進撃の巨人)
31+
- 3 seasons
32+
- 3 episodes

scripts/insert-test-data.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
echo "Inserting test data into MySQL..."
6+
7+
# genres
8+
docker exec -i wsperf-mysql mysql -u root wsperf << 'EOF'
9+
INSERT INTO genres (genreID, displayName) VALUES
10+
('976-755', 'アニメ'),
11+
('878-285', 'ドラマ'),
12+
('51-872', 'バラエティ'),
13+
('816-680', '映画'),
14+
('719-306', '格闘技');
15+
EOF
16+
17+
echo "✓ Inserted 5 genres"
18+
19+
# series
20+
docker exec -i wsperf-mysql mysql -u root wsperf << 'EOF'
21+
INSERT INTO series (seriesID, displayName, description, imageURL, genreID) VALUES
22+
('374-745', 'ONE PIECE', 'これは作品 ONE PIECE の説明文です。様々なジャンルの面白いコンテンツをお楽しみください。', 'https://image.p-c2-x.abema-tv.com/image/series/374-745', '976-755'),
23+
('77-257', '名探偵コナン', 'これは作品 名探偵コナン の説明文です。様々なジャンルの面白いコンテンツをお楽しみください。', 'https://image.p-c2-x.abema-tv.com/image/series/77-257', '878-285'),
24+
('937-848', 'ドラゴンボール', 'これは作品 ドラゴンボール の説明文です。様々なジャンルの面白いコンテンツをお楽しみください。', 'https://image.p-c2-x.abema-tv.com/image/series/937-848', '51-872'),
25+
('703-400', 'NARUTO', 'これは作品 NARUTO の説明文です。様々なジャンルの面白いコンテンツをお楽しみください。', 'https://image.p-c2-x.abema-tv.com/image/series/703-400', '816-680'),
26+
('565-598', '進撃の巨人', 'これは作品 進撃の巨人 の説明文です。様々なジャンルの面白いコンテンツをお楽しみください。', 'https://image.p-c2-x.abema-tv.com/image/series/565-598', '719-306');
27+
EOF
28+
29+
echo "✓ Inserted 5 series"
30+
31+
# seasons
32+
docker exec -i wsperf-mysql mysql -u root wsperf << 'EOF'
33+
INSERT INTO seasons (seasonID, seriesID, displayName, imageURL, displayOrder) VALUES
34+
('374-745_s1', '374-745', 'シーズン1', 'https://image.p-c2-x.abema-tv.com/image/series/374-745/season1', 1),
35+
('374-745_s2', '374-745', 'シーズン2', 'https://image.p-c2-x.abema-tv.com/image/series/374-745/season2', 2),
36+
('77-257_s1', '77-257', 'シーズン1', 'https://image.p-c2-x.abema-tv.com/image/series/77-257/season1', 1);
37+
EOF
38+
39+
echo "✓ Inserted 3 seasons"
40+
41+
# episodes
42+
docker exec -i wsperf-mysql mysql -u root wsperf << 'EOF'
43+
INSERT INTO episodes (episodeID, seasonID, seriesID, displayName, description, imageURL, displayOrder) VALUES
44+
('374-745_s1_e1', '374-745_s1', '374-745', '第1話', 'ONE PIECE 第1話の説明', 'https://image.p-c2-x.abema-tv.com/image/episode/374-745_s1_e1', 1),
45+
('374-745_s1_e2', '374-745_s1', '374-745', '第2話', 'ONE PIECE 第2話の説明', 'https://image.p-c2-x.abema-tv.com/image/episode/374-745_s1_e2', 2),
46+
('77-257_s1_e1', '77-257_s1', '77-257', '第1話', '名探偵コナン 第1話の説明', 'https://image.p-c2-x.abema-tv.com/image/episode/77-257_s1_e1', 1);
47+
EOF
48+
49+
echo "✓ Inserted 3 episodes"
50+
51+
echo ""
52+
echo "Test data inserted successfully!"
53+
echo "Total: 5 genres, 5 series, 3 seasons, 3 episodes"

0 commit comments

Comments
 (0)