Study 모델 3개 + 마이그레이션 + 시드 구현 (TDD)
ID: 156a3155-a41c-49a3-be1b-ebc9c7cfdbb5
Study::Course, Study::Chapter, Study::Lesson 3개 모델과 마이그레이션, 시드 데이터를 TDD로 구현합니다.
## 스키마
- study_courses: id(uuid), slug(string, unique index), title(string), subtitle(string), description(text), price_monthly(integer, default: 88000), completion_threshold(integer, default: 80), total_chapters(integer, default: 0), total_lessons(integer, default: 0), total_duration(integer, default: 0), is_active(boolean, default: false), timestamps
- study_chapters: id(uuid), course_id(uuid FK→study_courses), chapter_number(integer), title(string), description(text), is_preview(boolean, default: false), display_order(integer), timestamps, unique index(course_id, chapter_number)
- study_lessons: id(uuid), chapter_id(uuid FK→study_chapters), course_id(uuid FK→study_courses), lesson_number(integer), title(string), video_id(string), video_type(integer, enum: vimeo/youtube), duration_minutes(integer, default: 0), is_preview(boolean, default: false), materials_url(string), timestamps, unique index(chapter_id, lesson_number)
## 완료 기준
- 마이그레이션 성공 + 롤백 + 재마이그레이션
- 코스-챕터-레슨 계층 연관관계 동작
- course.recalculate_totals! 콜백 (챕터/레슨 수, 총 시간 자동 계산)
- 시드: "강점코치 입문 과정" 커리큘럼 (11챕터, ~20레슨)
- slug 자동 생성
첨부 이미지
이미지 추가 (Ctrl+V로 붙여넣기 또는 클릭)
JPEG, PNG, GIF, WebP / 최대 10MB
활동 로그
-
Ddeveloper-2 상태 변경: 리뷰 → 완료
2026년 03월 11일 12:48:02
-
Ddeveloper-2 Study 모델 3개 구현 완료 (46/46 테스트 통과)
2026년 03월 11일 12:41:08
상세 보기
## 생성된 파일
### 마이그레이션 (3)
- `db/migrate/20260311110000_create_study_courses.rb`
- `db/migrate/20260311110001_create_study_chapters.rb`
- `db/migrate/20260311110002_create_study_lessons.rb`### 모델 (4)
- `app/models/study.rb` — table_name_prefix "study_"
- `app/models/study/course.rb` — recalculate_totals!, slug 자동생성(한글 처리)
- `app/models/study/chapter.rb` — preview/ordered scopes
- `app/models/study/lesson.rb` — video_type enum (vimeo/youtube)### 테스트 (3파일, 46 tests)
- `test/models/study/course_test.rb` (18)
- `test/models/study/chapter_test.rb` (12)
- `test/models/study/lesson_test.rb` (16)### 시드
- `db/seeds/seed_study_courses.rb` — 강점코치 입문 과정 (11챕터, 24레슨, 353분)## 검증
- 46/46 테스트 통과
- 마이그레이션 → 롤백 → 재마이그레이션 성공
- 시드 idempotent 확인
- recalculate_totals! 정상 동작 -
Ddeveloper-2 상태 변경: 할 일 → 리뷰
2026년 03월 11일 12:41:02