Hanmaum ERD
Tables (32)
ai_proposal
- id — uuid — Foreign key → decision_entry.proposal_id — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- space_id — uuid — Foreign key → decision_entry.space_id — NOT NULL — 소속 돌봄 공간
- run_id — uuid — Foreign key → analysis_run.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- ordinal_no — bigint — NOT NULL — 응답 suggestions 내 순서
- ai_operation — text — NOT NULL — 현재 AI 계약 CREATE/UPDATE/RESOLVE만
- item_type — text — NOT NULL — 기존 AI 5유형
- target_item_id — uuid — Foreign key → item_revision.item_id — 명확한 대상일 때
- expected_version — bigint — Foreign key → item_revision.version — 명확한 대상의 분석 시점 버전
- output_document_id — uuid — Foreign key → content_document.id — NOT NULL — title·changes 등 AI 원 제안
- primary_evidence_id — uuid — Foreign key → evidence.id — NOT NULL — 입력 원문의 실제 근거
- relation_kind — text — '중복/상충 표현의 내부 후보
- invalidated_at — timestamptz — '삭제·근거 무효 등
- created_at — timestamptz — NOT NULL — 생성 시각(UTC instant)
- resolution — text — NOT NULL — OPEN/APPLIED/DECLINED 후보. 승인 요청 여부는 관련 요청에서 계산
- resolved_entry_id — uuid — Foreign key → decision_entry.id — 원 제안을 최종 반영/미적용한 결정
analysis_candidate
- run_id — uuid — Foreign key → analysis_run.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- item_id — uuid — Foreign key → item_revision.item_id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- space_id — uuid — Foreign key → content_document.space_id — NOT NULL — 소속 돌봄 공간
- item_version — bigint — Foreign key → item_revision.version — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- summary_document_id — uuid — Foreign key → content_document.id — NOT NULL — 'CANDIDATE_SUMMARY
analysis_run
- id — uuid — Primary key — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- space_id — uuid — Foreign key → space_membership.space_id — NOT NULL — 소속 돌봄 공간
- record_id — uuid — Foreign key → source_record.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- record_version — bigint — NOT NULL — 분석 시작 시 원본 버전
- generation_no — bigint — NOT NULL — 같은 분석 의도를 묶는 번호. 새 generation 조건은 O14
- attempt_no — bigint — NOT NULL — 실패 후 시도 구분
- request_id — uuid — NOT NULL — 기존 X-Request-Id와 같은 UUID
- input_recorded_at — timestamptz — NOT NULL — 원본의 최초 recordedAt 고정
- timezone — text — NOT NULL — 현재 정책 Asia/Seoul
- requested_by_membership_id — uuid — Foreign key → space_membership.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- status — text — NOT NULL — RUNNING/COMPLETED/FAILED/DISCARDED 후보
- error_code — text — '내부 안전 코드만
- started_at — timestamptz — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- finished_at — timestamptz — 완료/실패/폐기 시각
- invalidated_at — timestamptz — 완료 후 입력 근거 삭제 등으로 효력 상실
- command_id — uuid — Foreign key → command_receipt.id — 시작/재시도 명령 중복 방지
app_user
- id — uuid — Primary key — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- display_name — text — 표시 이름 후보. 필수값·길이는 O03/O17
- created_at — timestamptz — NOT NULL — 생성 시각(UTC instant)
- updated_at — timestamptz — NOT NULL — 마지막 프로필 수정 시각
care_item
- id — uuid — Foreign key → item_revision.item_id — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- space_id — uuid — Foreign key → item_revision.space_id — NOT NULL — 소속 돌봄 공간
- item_type — text — NOT NULL — SCHEDULE/TASK/QUESTION/OBSERVATION/GUIDANCE
- current_version — bigint — Foreign key → item_revision.version — NOT NULL — '공개 버전 후보
- created_at — timestamptz — NOT NULL — 생성 시각(UTC instant)
care_space
- id — uuid — Foreign key → space_membership.space_id — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- owner_membership_id — uuid — Foreign key → space_membership.id — NOT NULL — 현재 소유자의 참여 관계를 단일 참조
- subject_label — text — '부모님 이름 또는 호칭. Figma 206:759, 321:14840
- version — bigint — NOT NULL — 공간 정보·소유권·참여 변경의 동시성 검사
- lifecycle — text — NOT NULL — ACTIVE/DELETING 설계 제안
- created_at — timestamptz — NOT NULL — 생성 시각(UTC instant)
- updated_at — timestamptz — NOT NULL — 관계/처리 규칙은 검토 문서 참조
change_request
- id — uuid — Primary key — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- space_id — uuid — Foreign key → space_membership.space_id — NOT NULL — 소속 돌봄 공간
- submitted_by_membership_id — uuid — Foreign key → space_membership.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- submitted_at — timestamptz — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- submit_command_id — uuid — Foreign key → command_receipt.id — 중복 제출 방지
command_receipt
- id — uuid — Primary key — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- actor_user_id — uuid — Foreign key → app_user.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- client_request_id — uuid — NOT NULL — 클라이언트 멱등성 키(UUID) 제안
- command_kind — text — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- scope_key — text — NOT NULL — 대상 식별자만. 삭제 후 결과 조회를 위해 의도적으로 live FK를 두지 않음
- request_digest — text — NOT NULL — '정규화 입력의 키 기반 digest 제안
- status — text — NOT NULL — IN_PROGRESS/SUCCEEDED/REJECTED 후보
- result_refs — jsonb — '결과 종류·ID·버전만
- failure_details — jsonb — 안전 코드·문제 ID·버전만
- created_at — timestamptz — NOT NULL — 생성 시각(UTC instant)
- completed_at — timestamptz — 성공/확정 거절 시각
content_document
- id — uuid — Primary key — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- space_id — uuid — Foreign key → care_space.id — NOT NULL — 소속 돌봄 공간
- kind — text — NOT NULL — DIRECT_INPUT/ANSWER_INPUT/RECONFIRMATION/AI_OUTPUT/REVIEWED_CHANGE/CANDIDATE_SUMMARY 후보
- body — jsonb — 종류별 허용 키와 타입을 검증하는 JSON 객체
- redacted_paths — jsonb — NOT NULL — '제거한 JSON 경로만 보존
- created_at — timestamptz — NOT NULL — 생성 시각(UTC instant)
- redacted_at — timestamptz — 원본 삭제로 내용 제거한 시각
decision_batch
- id — uuid — Primary key — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- space_id — uuid — Foreign key → space_membership.space_id — NOT NULL — 소속 돌봄 공간
- decided_by_membership_id — uuid — Foreign key → space_membership.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- decision — text — NOT NULL — APPLY/DECLINE 설계 후보
- decided_at — timestamptz — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- command_id — uuid — Foreign key → command_receipt.id — 완료 영수증과 연결
decision_entry
- id — uuid — Primary key — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- space_id — uuid — Foreign key → item_revision.space_id — NOT NULL — 소속 돌봄 공간
- batch_id — uuid — Foreign key → decision_batch.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- entry_no — bigint — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- decision — text — Foreign key → decision_batch.decision — NOT NULL — batch와 일치해야 함
- action — text — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- proposal_id — uuid — Foreign key → ai_proposal.id — 원제안이 있으면 직접/요청 경로 모두 동일 ID
- request_entry_id — uuid — Foreign key → request_entry.id — 구성원 요청을 처리할 때
- reviewed_document_id — uuid — Foreign key → content_document.id — NOT NULL — 소유자가 실제 확인한 최종안
- target_item_id — uuid — Foreign key → item_revision.item_id — '생성/변경 결과의 대상
- expected_item_version — bigint — Foreign key → item_revision.version — 검토 당시 버전
- result_item_version — bigint — Foreign key → item_revision.version — 반영된 항목 버전
- result_space_version — bigint — 공간 변경 결과 버전
deletion_event
- id — uuid — Primary key — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- space_id — uuid — Foreign key → space_membership.space_id — NOT NULL — 소속 돌봄 공간
- record_id — uuid — Foreign key → source_record.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- deleted_by_membership_id — uuid — Foreign key → space_membership.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- deleted_at — timestamptz — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- command_id — uuid — Foreign key → command_receipt.id — 반복 삭제 결과 연결
document_field_evidence
- field_path — text — Primary key — NOT NULL — '허용 JSON Pointer
- document_id — uuid — Foreign key → content_document.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- evidence_id — uuid — Foreign key → evidence.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- space_id — uuid — Foreign key → evidence.space_id — NOT NULL — 소속 돌봄 공간
edit_lock
- item_id — uuid — Foreign key → care_item.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- space_id — uuid — Foreign key → space_membership.space_id — NOT NULL — 소속 돌봄 공간
- holder_membership_id — uuid — Foreign key → space_membership.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- lease_token_hash — text — NOT NULL — '브라우저 편집 세션별 소유 증명
- acquired_at — timestamptz — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- renewed_at — timestamptz — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- expires_at — timestamptz — NOT NULL — '기간/갱신 주기는 O07
evidence
- id — uuid — Primary key — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- space_id — uuid — Foreign key → space_membership.space_id — NOT NULL — 소속 돌봄 공간
- kind — text — NOT NULL — RECORD_QUOTE/DIRECT_INPUT/ANSWER/DERIVED/RECONFIRMATION 후보
- record_id — uuid — Foreign key → source_record.id — 원본 인용일 때 원본
- quote_start — bigint — 0부터 시작하는 UTF-16 code unit 오프셋(BE 문자열 기준) 설계 제안
- quote_end — bigint — UTF-16 code unit 끝 오프셋(exclusive). BE에서 원문 범위·인용 일치 검증
- document_id — uuid — Foreign key → content_document.id — 직접 입력·답변·파생 내용
- created_by_membership_id — uuid — Foreign key → space_membership.id — '사람 입력의 행위자
- lifecycle — text — NOT NULL — VALID/REDACTED 후보
- created_at — timestamptz — NOT NULL — 생성 시각(UTC instant)
- redacted_at — timestamptz — 원본 삭제로 내용 제거한 시각
evidence_dependency
- derived_evidence_id — uuid — Foreign key → evidence.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- parent_evidence_id — uuid — Foreign key → evidence.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- space_id — uuid — Foreign key → evidence.space_id — NOT NULL — 소속 돌봄 공간
guidance_revision
- revision_id — uuid — Foreign key → item_revision.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- space_id — uuid — Foreign key → item_revision.space_id — NOT NULL — 소속 돌봄 공간
- item_type — text — Foreign key → item_revision.item_type — NOT NULL — 상위 revision 유형과 일치
- source_name — text — 병원·기관 등 전달 주체 표현 후보
- received_date — date — 안내받은 날짜 후보
invitation
- id — uuid — Primary key — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- space_id — uuid — Foreign key → space_membership.space_id — NOT NULL — 소속 돌봄 공간
- issued_by_membership_id — uuid — Foreign key → space_membership.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- token_hash — text — NOT NULL — 추측 어려운 토큰의 해시만 저장
- issued_at — timestamptz — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- expires_at — timestamptz — NOT NULL — 발급 시점 + 24시간(확정 정책)
- revoked_at — timestamptz — 해지·재발급의 영향은 O11
item_revision
- id — uuid — Primary key — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- space_id — uuid — Foreign key → decision_entry.space_id — NOT NULL — 소속 돌봄 공간
- item_id — uuid — Foreign key → care_item.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- version — bigint — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- item_type — text — Foreign key → care_item.item_type — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- title — text — '유형별 제목·할 일·질문 등 후보
- description — text — 추가 설명·본문·메모 후보
- visibility — text — NOT NULL — 'VISIBLE/DELETED
- needs_reconfirmation — boolean — NOT NULL — 근거 삭제 후 재확인 표시. 업무 완료 상태와 별도
- changed_by_membership_id — uuid — Foreign key → space_membership.id — 시스템 연결 정리면 NULL 가능
- change_kind — text — NOT NULL — 생성·수정·담당자·상태·해소·일반삭제·근거연결·원본정리 등
- changed_at — timestamptz — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- decision_entry_id — uuid — Foreign key → decision_entry.id — 승인으로 생긴 revision
- command_id — uuid — Foreign key → command_receipt.id — 직접 허용 변경·삭제 전파도 같은 명령으로 묶음
- redacted_fields — jsonb — NOT NULL — '삭제로 제거한 필드명만
- redacted_at — timestamptz — 원본 삭제로 내용 제거한 시각
observation_revision
- revision_id — uuid — Foreign key → item_revision.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- space_id — uuid — Foreign key → item_revision.space_id — NOT NULL — 소속 돌봄 공간
- item_type — text — Foreign key → item_revision.item_type — NOT NULL — 상위 revision 유형과 일치
- observed_date — date — 알려진 관찰 날짜만
- observed_time_text — text — 점심·어젯밤 같은 원문 시간 표현 후보
proposal_candidate
- proposal_id — uuid — Foreign key → ai_proposal.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- item_id — uuid — Foreign key → item_revision.item_id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- space_id — uuid — Foreign key → item_revision.space_id — NOT NULL — 소속 돌봄 공간
- expected_version — bigint — Foreign key → item_revision.version — NOT NULL — 관계/처리 규칙은 검토 문서 참조
question_answer
- id — uuid — Primary key — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- space_id — uuid — Foreign key → evidence.space_id — NOT NULL — 소속 돌봄 공간
- question_item_id — uuid — Foreign key → care_item.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- item_type — text — Foreign key → care_item.item_type — NOT NULL — QUESTION으로 고정
- submitted_by_membership_id — uuid — Foreign key → space_membership.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- answer_evidence_id — uuid — Foreign key → evidence.id — NOT NULL — ANSWER 근거의 ANSWER_INPUT 문서에 answer/basis를 보관
- submitted_at — timestamptz — NOT NULL — 관계/처리 규칙은 검토 문서 참조
question_revision
- revision_id — uuid — Foreign key → item_revision.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- space_id — uuid — Foreign key → item_revision.space_id — NOT NULL — 소속 돌봄 공간
- item_type — text — Foreign key → item_revision.item_type — NOT NULL — 상위 revision 유형과 일치
- status — text — NOT NULL — UNCONFIRMED/CONFIRMED 후보
- confirmed_answer — text — '소유자가 확정한 현재 답
request_entry
- id — uuid — Primary key — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- space_id — uuid — Foreign key → item_revision.space_id — NOT NULL — 소속 돌봄 공간
- request_id — uuid — Foreign key → change_request.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- entry_no — bigint — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- action — text — NOT NULL — '허용 동작 분류는 아래 별도 표
- proposal_id — uuid — Foreign key → ai_proposal.id — AI 제안에서 온 요청
- target_item_id — uuid — Foreign key → item_revision.item_id — 기존 항목 변경이면 필수
- expected_item_version — bigint — Foreign key → item_revision.version — 기존 항목 검토 버전
- expected_space_version — bigint — 공간 정보 수정이면 필수
- reviewed_document_id — uuid — Foreign key → content_document.id — NOT NULL — 제출한 수정안·선택 대상의 스냅샷
- answer_id — uuid — Foreign key → question_answer.id — 질문 답변 요청일 때
- invalidated_at — timestamptz — 원본·대상 상실. 승인 거절과 구분
revision_field_evidence
- field_key — text — Primary key — NOT NULL — title, scheduled_date, confirmed_answer 등 허용 목록. __item__은 단순 연관
- revision_id — uuid — Foreign key → item_revision.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- evidence_id — uuid — Foreign key → evidence.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- space_id — uuid — Foreign key → evidence.space_id — NOT NULL — 소속 돌봄 공간
schedule_revision
- revision_id — uuid — Foreign key → item_revision.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- space_id — uuid — Foreign key → item_revision.space_id — NOT NULL — 소속 돌봄 공간
- item_type — text — Foreign key → item_revision.item_type — NOT NULL — 상위 revision 유형과 일치
- scheduled_date — date — 날짜 입력/미정 정책 O04
- scheduled_time — time without time zone — '정확히 언급/입력한 시각만
- location — text — '장소 후보
- status — text — NOT NULL — SCHEDULED/COMPLETED/CANCELED 후보
share_link
- id — uuid — Primary key — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- space_id — uuid — Foreign key → space_membership.space_id — NOT NULL — 소속 돌봄 공간
- created_by_membership_id — uuid — Foreign key → space_membership.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- token_hash — text — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- created_at — timestamptz — NOT NULL — 생성 시각(UTC instant)
- expires_at — timestamptz — 공유 만료 정책 O11. NULL을 영구 유효 정책으로 확정하지 않음
share_target
- share_link_id — uuid — Foreign key → share_link.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- item_id — uuid — Foreign key → item_revision.item_id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- space_id — uuid — Foreign key → item_revision.space_id — NOT NULL — 소속 돌봄 공간
- shared_revision_no — bigint — Foreign key → item_revision.version — NOT NULL — '공유 당시 확정 버전
- includes_change — boolean — NOT NULL — 외부 카드에 표시할 변경 여부만
social_account
- id — uuid — Primary key — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- user_id — uuid — Foreign key → app_user.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- provider — text — NOT NULL — Google/Kakao
- provider_user_id — text — NOT NULL — 제공자 내 식별자. 이메일을 식별키로 사용하지 않음
- created_at — timestamptz — NOT NULL — 생성 시각(UTC instant)
source_record
- id — uuid — Primary key — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- space_id — uuid — Foreign key → space_membership.space_id — NOT NULL — 소속 돌봄 공간
- author_membership_id — uuid — Foreign key → space_membership.id — 원본 작성자. 삭제 후 최소 기록 범위 검토
- body — text — '사용자 원문
- recorded_at — timestamptz — 상대 날짜의 고정 기준. 삭제 후 최소 기록 범위 검토
- version — bigint — NOT NULL — 삭제·재노출 방지를 위한 세대/버전
- lifecycle — text — NOT NULL — ACTIVE/ERASED 후보
- erased_at — timestamptz — 삭제 완료 시각
- create_command_id — uuid — Foreign key → command_receipt.id — 원본 저장 중복 방지 처리 영수증
space_membership
- id — uuid — Primary key — NOT NULL — 엔티티 식별자. UUID 생성 방식은 구현 시 선택
- space_id — uuid — Foreign key → invitation.space_id — NOT NULL — 소속 돌봄 공간
- user_id — uuid — Foreign key → app_user.id — '탈퇴하면 NULL
- joined_at — timestamptz — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- ended_at — timestamptz — NULL이면 현재 참여
- end_reason — text — LEFT/REMOVED/ACCOUNT_WITHDRAWAL 후보
- invitation_id — uuid — Foreign key → invitation.id — 초대로 참여한 경우
task_revision
- revision_id — uuid — Foreign key → item_revision.id — NOT NULL — 관계/처리 규칙은 검토 문서 참조
- space_id — uuid — Foreign key → space_membership.space_id — NOT NULL — 소속 돌봄 공간
- item_type — text — Foreign key → item_revision.item_type — NOT NULL — 상위 revision 유형과 일치
- due_date — date — 기한 후보
- assignee_membership_id — uuid — Foreign key → space_membership.id — 한 명 또는 미지정. 완료 이력은 종료된 참여를 참조 가능
- status — text — NOT NULL — NOT_STARTED/IN_PROGRESS/COMPLETED 후보