sttt
Tables (11)
device_tokens
- token_id — BIGINT — Primary key — NOT NULL — 토큰 PK
- user_id — BIGINT — Foreign key → users.user_id — NOT NULL — 유저 FK
- device_token — VARCHAR(255) — NOT NULL — FCM 기기 토큰
- device_type — VARCHAR(20) — NOT NULL — 기기 타입 (IOS, ANDROID)
- updated_at — DATETIME — NOT NULL — 최근 갱신 일시
drugs
- atc_code — VARCHAR(20) — Primary key — NOT NULL — ATC 코드 (PK)
- drug_name — VARCHAR(255) — NOT NULL — 한글 약품명
- company — VARCHAR(100) — 제약회사명
families
- family_id — BIGINT — Primary key — NOT NULL — 가족 관계 PK
- user_id — BIGINT — Foreign key → users.user_id — NOT NULL — 내 유저 FK
- target_user_id — BIGINT — Foreign key → users.user_id — NOT NULL — 가족 구성원 유저 FK
- relation — VARCHAR(50) — NOT NULL — 내가 부르는 호칭
- is_alert_consent — BOOLEAN — NOT NULL — 해당 가족의 약 미복용 알림 수신 여부 (개별 스위치)
- created_at — DATETIME — NOT NULL — 연동 일시
family_requests
- request_id — BIGINT — Primary key — NOT NULL — 요청 PK
- sender_id — BIGINT — Foreign key → users.user_id — NOT NULL — 초대장 보낸 유저 FK
- receiver_id — BIGINT — Foreign key → users.user_id — NOT NULL — 초대장 받은 유저 FK
- proposed_relation — VARCHAR(50) — NOT NULL — 보낸 사람이 부르는 호칭 (예: MOTHER)
- status — VARCHAR(20) — NOT NULL — 상태 (PENDING, ACCEPTED, REJECTED, CANCELLED, EXPIRED)
- requested_at — DATETIME — NOT NULL — 요청 일시
- updated_at — DATETIME — NOT NULL — 상태 변경 일시
medication_records
- record_id — BIGINT — Primary key — NOT NULL — 기록 PK
- prescription_id — BIGINT — Foreign key → prescriptions.prescription_id — NOT NULL — 처방전 FK
- user_id — BIGINT — Foreign key → users.user_id — NOT NULL — 유저 FK (조회 성능 최적화용)
- scheduled_time — DATETIME — NOT NULL — 약 먹기로 예정된 시간 (날짜+시간)
- taken_time — DATETIME — 실제 약 먹은 시간 (버튼 누른 시간)
- status — VARCHAR(20) — NOT NULL — DB 저장 상태 (PENDING, SUCCESS, SKIP)
- created_at — DATETIME — NOT NULL — 스케줄 생성 일시
- updated_at — DATETIME — NOT NULL — 상태 변경 일시
notifications
- notification_id — BIGINT — Primary key — NOT NULL — 알림 이력 PK
- user_id — BIGINT — Foreign key → users.user_id — NOT NULL — 알림 받은 유저 FK
- type — VARCHAR(50) — NOT NULL — 알림 타입 (FAMILY_SUCCESS, MY_MISSED 등)
- title — VARCHAR(255) — NOT NULL — 알림 제목
- message — TEXT — NOT NULL — 알림 상세 내용
- created_at — DATETIME — NOT NULL — 발송(생성) 일시
prescription_drugs
- prescription_drug_id — BIGINT — Primary key — NOT NULL — 매핑 PK
- prescription_id — BIGINT — Foreign key → prescriptions.prescription_id — NOT NULL — 처방전 FK
- atc_code — VARCHAR(20) — Foreign key → drugs.atc_code — NOT NULL — 약품 ATC 코드 FK
prescriptions
- prescription_id — BIGINT — Primary key — NOT NULL — 처방전 PK
- user_id — BIGINT — Foreign key → users.user_id — NOT NULL — 유저 FK
- title — VARCHAR(255) — NOT NULL — 처방전 이름 (예: 이비인후과 감기약)
- start_date — DATE — NOT NULL — 복용 시작일
- end_date — DATE — NOT NULL — 복용 종료일
- created_at — DATETIME — NOT NULL — 등록 일시
- updated_at — DATETIME — NOT NULL — 수정 일시
user_allergies
- allergy_id — BIGINT — Primary key — NOT NULL — 알러지 PK
- user_id — BIGINT — Foreign key → users.user_id — NOT NULL — 유저 FK
- atc_code — VARCHAR(20) — Foreign key → drugs.atc_code — NOT NULL — 알러지 반응 약품 ATC 코드 FK
user_diseases
- disease_id — BIGINT — Primary key — NOT NULL — 질환 PK
- user_id — BIGINT — Foreign key → users.user_id — NOT NULL — 유저 FK
- disease_name — VARCHAR(100) — NOT NULL — 질환명 (예: 당뇨, 고혈압)
users
- user_id — BIGINT — Primary key — NOT NULL — 유저 고유 PK
- provider — VARCHAR(50) — NOT NULL — 소셜 플랫폼 (kakao, naver)
- social_id — VARCHAR(255) — NOT NULL — 소셜 플랫폼 고유 ID
- invite_code — VARCHAR(20) — NOT NULL — 가족 연동 고유 초대 코드
- birth_date — DATE — 생년월일 (YYYY-MM-DD)
- gender — CHAR(1) — 성별 (M, F)
- height — INT — 키 (cm)
- weight — INT — 몸무게 (kg)
- blood_type — VARCHAR(2) — 혈액형 (A, B, O, AB)
- is_tutorial_completed — BOOLEAN — NOT NULL — 튜토리얼 완료 여부
- is_my_reminder_on — BOOLEAN — NOT NULL — 본인 복약 알림 수신 여부
- is_family_reminder_on — BOOLEAN — NOT NULL — 가족 복약 알림 수신 마스터 스위치
- is_missed_alert_on — BOOLEAN — NOT NULL — 미복용 긴급 알림 수신 여부
- created_at — DATETIME — NOT NULL — 가입일시
- updated_at — DATETIME — NOT NULL — 수정일시