건강원 HealthWon ERD

테이블 (21)

activity_records

  • health_event_id — uuid — 외래 키 → health_events.id
  • steps — integer
  • active_minutes — integer
  • active_kcal — decimal(8,2)
  • workout_type — varchar(80)
  • distance_meters — decimal(10,2)

ai_analysis_results

  • id — uuid
  • health_event_id — uuid — 외래 키 → health_events.id
  • media_asset_id — uuid — 외래 키 → media_assets.id
  • analysis_type — varchar(50) — NOT NULL
  • model_name — varchar(100) — NOT NULL
  • confidence_score — decimal(4,3)
  • result_payload — text
  • safety_notice — text — NOT NULL
  • created_at — timestamp — NOT NULL

beverage_logs

  • health_event_id — uuid — 외래 키 → health_events.id
  • beverage_type — varchar(50) — NOT NULL
  • name — varchar(120)
  • volume_ml — decimal(8,2)
  • kcal — decimal(8,2)
  • sugar_g — decimal(8,2)
  • caffeine_mg — decimal(8,2)
  • analysis_status — varchar(30) — NOT NULL

cosmetic_ingredients

  • id — uuid
  • cosmetic_product_id — uuid — 외래 키 → cosmetic_products.id — NOT NULL
  • ingredient_name — varchar(255) — NOT NULL
  • safety_level — varchar(30) — NOT NULL
  • effect_summary — text
  • caution_summary — text

cosmetic_products

  • id — uuid
  • user_id — uuid — 외래 키 → users.id — NOT NULL
  • name — varchar(120) — NOT NULL
  • brand — varchar(120)
  • product_type — varchar(80)
  • skin_type_target — varchar(80)
  • created_at — timestamp — NOT NULL
  • updated_at — timestamp — NOT NULL

cosmetic_usage_logs

  • health_event_id — uuid — 외래 키 → health_events.id
  • cosmetic_product_id — uuid — 외래 키 → cosmetic_products.id — NOT NULL
  • body_area — varchar(80)
  • reaction_note — text

data_sources

  • id — uuid
  • user_id — uuid — 외래 키 → users.id — NOT NULL
  • source_type — varchar(30) — NOT NULL
  • display_name — varchar(100) — NOT NULL
  • external_account_id — varchar(255)
  • authorized_at — timestamp
  • revoked_at — timestamp
  • created_at — timestamp — NOT NULL

food_items

  • id — uuid
  • meal_log_id — uuid — 외래 키 → meal_logs.health_event_id — NOT NULL
  • name — varchar(120) — NOT NULL
  • serving_amount — decimal(8,2)
  • serving_unit — varchar(30)
  • kcal — decimal(8,2)
  • carbs_g — decimal(8,2)
  • protein_g — decimal(8,2)
  • fat_g — decimal(8,2)
  • confidence_score — decimal(4,3)

health_events

  • id — uuid
  • user_id — uuid — 외래 키 → users.id — NOT NULL
  • event_type — varchar(30) — NOT NULL
  • source_id — uuid — 외래 키 → data_sources.id
  • external_record_id — varchar(255)
  • started_at — timestamp — NOT NULL
  • ended_at — timestamp
  • timezone — varchar(80) — NOT NULL
  • confidence_score — decimal(4,3) — NOT NULL
  • raw_payload — text
  • created_at — timestamp — NOT NULL

intake_logs

  • health_event_id — uuid — 외래 키 → health_events.id
  • medication_item_id — uuid — 외래 키 → medication_items.id
  • supplement_item_id — uuid — 외래 키 → supplement_items.id
  • taken_at — timestamp — NOT NULL
  • status — varchar(30) — NOT NULL
  • note — text

interaction_check_items

  • id — uuid
  • interaction_check_id — uuid — 외래 키 → interaction_checks.id — NOT NULL
  • medication_item_id — uuid — 외래 키 → medication_items.id
  • supplement_item_id — uuid — 외래 키 → supplement_items.id
  • item_type — varchar(30) — NOT NULL

interaction_checks

  • id — uuid
  • user_id — uuid — 외래 키 → users.id — NOT NULL
  • risk_level — varchar(20) — NOT NULL
  • summary — text — NOT NULL
  • recommendation — text — NOT NULL
  • evidence_payload — text
  • created_at — timestamp — NOT NULL

meal_logs

  • health_event_id — uuid — 외래 키 → health_events.id
  • meal_type — varchar(30) — NOT NULL
  • total_kcal — decimal(8,2)
  • carbs_g — decimal(8,2)
  • protein_g — decimal(8,2)
  • fat_g — decimal(8,2)
  • analysis_status — varchar(30) — NOT NULL

media_assets

  • id — uuid
  • user_id — uuid — 외래 키 → users.id — NOT NULL
  • health_event_id — uuid — 외래 키 → health_events.id
  • media_type — varchar(40) — NOT NULL
  • purpose — varchar(60) — NOT NULL
  • storage_url — text — NOT NULL
  • content_hash — varchar(255)
  • created_at — timestamp — NOT NULL

medication_items

  • id — uuid
  • user_id — uuid — 외래 키 → users.id — NOT NULL
  • name — varchar(120) — NOT NULL
  • ingredient_name — varchar(255)
  • dose_amount — varchar(80)
  • instructions — text
  • created_at — timestamp — NOT NULL

notification_logs

  • id — uuid
  • user_id — uuid — 외래 키 → users.id — NOT NULL
  • reminder_rule_id — uuid — 외래 키 → reminder_rules.id
  • scheduled_at — timestamp — NOT NULL
  • sent_at — timestamp
  • status — varchar(30) — NOT NULL
  • created_at — timestamp — NOT NULL

reminder_rules

  • id — uuid
  • user_id — uuid — 외래 키 → users.id — NOT NULL
  • target_type — varchar(50) — NOT NULL
  • target_id — uuid
  • title — varchar(120) — NOT NULL
  • rrule — text — NOT NULL
  • is_active — boolean — NOT NULL
  • created_at — timestamp — NOT NULL
  • updated_at — timestamp — NOT NULL

sleep_records

  • health_event_id — uuid — 외래 키 → health_events.id
  • total_minutes — integer — NOT NULL
  • awake_minutes — integer
  • deep_sleep_minutes — integer
  • rem_sleep_minutes — integer
  • sleep_score — decimal(5,2)
  • quality_note — text

supplement_items

  • id — uuid
  • user_id — uuid — 외래 키 → users.id — NOT NULL
  • name — varchar(120) — NOT NULL
  • ingredient_name — varchar(255)
  • dose_amount — varchar(80)
  • instructions — text
  • created_at — timestamp — NOT NULL

user_profiles

  • user_id — uuid — 외래 키 → users.id
  • birth_date — date
  • sex — varchar(20)
  • height_cm — decimal(5,2)
  • weight_kg — decimal(5,2)
  • activity_goal — varchar(100)
  • timezone — varchar(80) — NOT NULL
  • allergies — text
  • health_notes — text

users

  • id — uuid
  • email — varchar(255) — NOT NULL
  • password_hash — varchar(255) — NOT NULL
  • display_name — varchar(100) — NOT NULL
  • created_at — timestamp — NOT NULL
  • updated_at — timestamp — NOT NULL