erd

Tables (7)

sessions

  • session_id — VARCHAR(255) — Primary key
  • user_id — BIGINT — Foreign key → users.user_id
  • created_at — DATETIME
  • expires_at — DATETIME

subscriptions

  • sub_id — BIGINT — Primary key
  • user_id — BIGINT — Foreign key → users.user_id
  • is_active — BOOLEAN
  • start_date — DATETIME
  • end_date — DATETIME

users

  • user_id — BIGINT — Primary key
  • login_id — VARCHAR(50) — NOT NULL
  • password_hash — VARCHAR(255) — NOT NULL
  • name — VARCHAR(50) — NOT NULL
  • phone_number — VARCHAR(20)
  • signup_date — DATETIME

wearable_data

  • data_id — BIGINT — Primary key
  • device_id — BIGINT — Foreign key → wearable_devices.device_id
  • user_id — BIGINT — Foreign key → wearable_devices.user_id
  • record_date — DATETIME — NOT NULL
  • heart_rate — INT
  • calories — FLOAT
  • steps — INT
  • workout_time — INT
  • distance — FLOAT
  • created_at — DATETIME

wearable_devices

  • device_id — BIGINT — Primary key
  • user_id — BIGINT — Foreign key → users.user_id
  • device_type — VARCHAR(50)
  • is_active — BOOLEAN
  • registered_at — DATETIME

workout_logs

  • log_id — BIGINT — Primary key
  • rec_id — BIGINT — Foreign key → workout_recommendations.rec_id
  • user_id — BIGINT — Foreign key → users.user_id
  • logged_at — DATETIME
  • workout_date — DATE — NOT NULL
  • source — ENUM('user_input', 'wearable')
  • workout_data — JSON

workout_recommendations

  • rec_id — BIGINT — Primary key
  • user_id — BIGINT — Foreign key → users.user_id
  • recommended_at — DATETIME
  • for_date — DATE
  • used_wearable — BOOLEAN
  • recommendation — JSON