5bde1c765c
asyncpg 러너가 exec_driver_sql 을 prepared statement(extended protocol)로 처리해 multi-statement 를 거부(cannot insert multiple commands) → fastapi init_db crash. (001 등 초기 multi-stmt 는 postgres initdb=psql simple protocol 로 적용됐던 것 — 작성자 가정 오류.) 301~305(각 2~4 stmt)를 내용 불변으로 16개 single-statement 파일(301~316)로 분리: eid_study_weakness(table/rule2/idx)·eid_review_set_draft(동)·eid_weekly_recap(동) ·approval_requests(table/idx)·eid_schedule_views(view2). 원순서·FK 의존성 보존. 프로덕션 pkm DB 대상 트랜잭션 dry-run(ROLLBACK) 16/16 무오류 통과. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
15 lines
1.0 KiB
SQL
15 lines
1.0 KiB
SQL
-- 305_eid_review_set_draft_table.sql — 302_eid_review_set_draft.sql 분리본 (single-statement). asyncpg 러너가 prepared statement 로 처리해 multi-statement 거부 → 1 stmt/파일. 내용 불변.
|
|
|
|
CREATE TABLE IF NOT EXISTS eid_review_set_draft (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
user_id BIGINT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
study_topic_id BIGINT REFERENCES study_topics(id) ON DELETE CASCADE, -- nullable = cross-topic 세트
|
|
question_ids JSONB NOT NULL, -- ordered list[int]
|
|
reason VARCHAR(40) NOT NULL, -- chronic | relapse | coverage | overdue
|
|
actor VARCHAR(20) NOT NULL, -- 스탬프 = 'eid'
|
|
source_weakness_id BIGINT REFERENCES eid_study_weakness(id) ON DELETE SET NULL,
|
|
source_generated_at TIMESTAMPTZ NOT NULL, -- 스탬프
|
|
supersedes_id BIGINT REFERENCES eid_review_set_draft(id) ON DELETE SET NULL,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|