soma

Tables (14)

calendar_connections

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • provider — VARCHAR(20) — NOT NULL
  • external_calendar_id — VARCHAR(255) — NOT NULL
  • connection_status — VARCHAR(20) — NOT NULL
  • sync_cursor — TEXT
  • last_synced_at — TIMESTAMP
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

diaries

  • id — BIGINT — Primary key — NOT NULL
  • journaling_session_id — BIGINT — Foreign key → journaling_sessions.id — NOT NULL
  • diary_type — VARCHAR(30) — NOT NULL
  • status — VARCHAR(20) — NOT NULL
  • current_revision_no — INTEGER — NOT NULL
  • saved_at — TIMESTAMP
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL
  • deleted_at — TIMESTAMP

diary_revisions

  • id — BIGINT — Primary key — NOT NULL
  • diary_id — BIGINT — Foreign key → diaries.id — NOT NULL
  • revision_no — INTEGER — NOT NULL
  • revision_source — VARCHAR(30) — NOT NULL
  • content — TEXT — NOT NULL
  • created_at — TIMESTAMP — NOT NULL

emotion_types

  • id — BIGINT — Primary key — NOT NULL
  • code — VARCHAR(30) — NOT NULL
  • name — VARCHAR(30) — NOT NULL
  • display_order — INTEGER — NOT NULL
  • is_active — BOOLEAN — NOT NULL

journaling_analyses

  • journaling_session_id — BIGINT — Foreign key → journaling_sessions.id — NOT NULL
  • analysis_data — JSON — NOT NULL
  • evidence_data — JSON
  • safety_status — VARCHAR(20) — NOT NULL
  • prompt_version — VARCHAR(50)
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

journaling_messages

  • id — BIGINT — Primary key — NOT NULL
  • journaling_session_id — BIGINT — Foreign key → journaling_sessions.id — NOT NULL
  • role — VARCHAR(20) — NOT NULL
  • content — TEXT — NOT NULL
  • sequence — INTEGER — NOT NULL
  • message_status — VARCHAR(20) — NOT NULL
  • created_at — TIMESTAMP — NOT NULL

journaling_sessions

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • journaling_date — DATE — NOT NULL
  • current_emotion_type_id — BIGINT — Foreign key → emotion_types.id
  • current_emotion_intensity — SMALLINT
  • context_snapshot — JSON
  • route_code — VARCHAR(50)
  • status — VARCHAR(20) — NOT NULL
  • question_count — INTEGER — NOT NULL
  • session_summary — TEXT
  • started_at — TIMESTAMP — NOT NULL
  • last_active_at — TIMESTAMP — NOT NULL
  • completed_at — TIMESTAMP
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

schedule_checkins

  • schedule_id — BIGINT — Foreign key → schedules.id — NOT NULL
  • emotion_type_id — BIGINT — Foreign key → emotion_types.id
  • intensity — SMALLINT
  • memo — TEXT
  • recorded_at — TIMESTAMP
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

schedules

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • calendar_connection_id — BIGINT — Foreign key → calendar_connections.id
  • external_event_id — VARCHAR(255)
  • source — VARCHAR(20) — NOT NULL
  • title — VARCHAR(255) — NOT NULL
  • start_at — TIMESTAMP
  • end_at — TIMESTAMP
  • is_all_day — BOOLEAN — NOT NULL
  • completion_status — VARCHAR(20) — NOT NULL
  • display_order — INTEGER
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL
  • deleted_at — TIMESTAMP

social_accounts

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • provider — VARCHAR(20) — NOT NULL
  • provider_user_id — VARCHAR(255) — NOT NULL
  • email — VARCHAR(255)
  • created_at — TIMESTAMP — NOT NULL

user_interest_areas

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • interest_code — VARCHAR(50) — NOT NULL
  • priority — INTEGER — NOT NULL
  • created_at — TIMESTAMP — NOT NULL

user_profiles

  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • nickname — VARCHAR(30) — NOT NULL
  • age_group_code — VARCHAR(20) — NOT NULL
  • gender_code — VARCHAR(20)
  • notification_enabled — BOOLEAN — NOT NULL
  • journaling_time — TIME
  • timezone — VARCHAR(50) — NOT NULL
  • onboarding_completed_at — TIMESTAMP
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

user_recovery_preferences

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • recovery_code — VARCHAR(50) — NOT NULL
  • priority — INTEGER — NOT NULL
  • created_at — TIMESTAMP — NOT NULL

users

  • id — BIGINT — Primary key — NOT NULL
  • status — VARCHAR(20) — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL
  • deleted_at — TIMESTAMP