fix(study): 마이그레이션 198 single-statement 분리 — 199_idx 추가
CREATE TABLE + CREATE INDEX 한 파일에 들어가 asyncpg prepared statement 원칙 위반 (cannot insert multiple commands). 198 = TABLE 만, 199 = idx 분리. 첫 시작에서 198 적용 fail 로 init_db 트랜잭션 전체 롤백 → 컨테이너 시작 후 schema_migrations 미반영 + study_question_images 테이블 미생성. 본 fix 후 다음 시작 시 198+199 순차 적용.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
-- 198_study_question_images.sql
|
||||
-- 198_study_question_images.sql (1/2)
|
||||
-- 문제별 첨부 이미지 (PR-8). 한 문제에 여러 이미지 가능 (회로도+그래프 등).
|
||||
--
|
||||
-- 저장 위치: NAS `/documents/study_question_images/{topic_id}/{question_id}/{image_id}.{ext}`
|
||||
@@ -16,6 +16,3 @@ CREATE TABLE IF NOT EXISTS study_question_images (
|
||||
sort_order INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_study_question_images_qid
|
||||
ON study_question_images (study_question_id, sort_order, id);
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
-- 199_study_question_images_idx.sql (2/2)
|
||||
-- study_question 별 이미지 정렬 조회 (sort_order 오름차순).
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_study_question_images_qid
|
||||
ON study_question_images (study_question_id, sort_order, id);
|
||||
Reference in New Issue
Block a user