kiwi_erd

Tables (16)

accounts

  • account_id — bigint — Primary key — NOT NULL
  • email — character — NOT NULL
  • password_hash — character — NOT NULL
  • created_at — timestamp — NOT NULL
  • updated_at — timestamp — NOT NULL
  • is_deleted — boolean — NOT NULL
  • deleted_at — timestamp
  • is_verified — boolean — NOT NULL
  • verified_at — timestamp

cbt_answers

  • answer_id — bigint — Primary key — NOT NULL
  • cbt_session_id — bigint — Foreign key → cbt_sessions.cbt_session_id — NOT NULL
  • question_id — bigint — Foreign key → cbt_questions.question_id — NOT NULL
  • answer_text — text
  • created_at — timestamp — NOT NULL
  • updated_at — timestamp — NOT NULL
  • answer_value — integer

cbt_questions

  • question_id — bigint — Primary key — NOT NULL
  • code — character — NOT NULL
  • question_text — text — NOT NULL
  • display_order — integer — NOT NULL
  • is_required — boolean — NOT NULL
  • is_active — boolean — NOT NULL
  • tool_code — character — NOT NULL
  • input_type — character — NOT NULL
  • CHECKBOX::character — varying
  • SLIDER::character — varying
  • GUIDE::character — varying)::text)))

cbt_sessions

  • cbt_session_id — bigint — Primary key — NOT NULL
  • record_id — bigint — Foreign key → records.record_id — NOT NULL
  • tag_id — bigint — Foreign key → tags.tag_id — NOT NULL
  • before_emotion_score — integer
  • after_emotion_score — integer
  • created_at — timestamp — NOT NULL
  • updated_at — timestamp — NOT NULL
  • tool_code — character — NOT NULL

diaries

  • diary_id — bigint — Primary key — NOT NULL
  • record_id — bigint — Foreign key → records.record_id — NOT NULL
  • title — character — NOT NULL
  • content — text — NOT NULL
  • created_at — timestamp — NOT NULL
  • updated_at — timestamp — NOT NULL

item_categories

  • item_category_id — bigint — Primary key — NOT NULL
  • name — character — NOT NULL
  • created_at — timestamp — NOT NULL

items

  • item_id — bigint — Primary key — NOT NULL
  • item_category_id — bigint — Foreign key → item_categories.item_category_id — NOT NULL
  • name — character — NOT NULL
  • description — character
  • image_url — character
  • price — integer — NOT NULL
  • is_active — boolean — NOT NULL
  • created_at — timestamp — NOT NULL
  • updated_at — timestamp — NOT NULL

keywords

  • keyword_id — bigint — Primary key — NOT NULL
  • user_id — bigint — Foreign key → users.user_id — NOT NULL
  • name — character — NOT NULL
  • created_at — timestamp — NOT NULL

kiwi_transactions

  • tx_id — bigint — Primary key — NOT NULL
  • user_id — bigint — Foreign key → users.user_id — NOT NULL
  • amount — integer — NOT NULL
  • type — public.kiwi_tx_type — NOT NULL
  • created_at — timestamp — NOT NULL

record_keywords

  • keyword_id — bigint — Foreign key → keywords.keyword_id — NOT NULL
  • record_id — bigint — Foreign key → records.record_id — NOT NULL

records

  • record_id — bigint — Primary key — NOT NULL
  • user_id — bigint — Foreign key → users.user_id — NOT NULL
  • record_date — date — NOT NULL
  • mood_score — integer — NOT NULL
  • created_at — timestamp — NOT NULL
  • updated_at — timestamp — NOT NULL

report_alerts

  • report_alert_id — bigint — Primary key — NOT NULL
  • user_id — bigint — Foreign key → users.user_id — NOT NULL
  • type — public.report_alert_type — NOT NULL
  • title — character — NOT NULL
  • message — character — NOT NULL
  • related_start_date — date
  • related_end_date — date
  • is_read — boolean — NOT NULL
  • read_at — timestamp
  • is_deleted — boolean — NOT NULL
  • deleted_at — timestamp
  • created_at — timestamp — NOT NULL
  • updated_at — timestamp — NOT NULL

tags

  • tag_id — bigint — Primary key — NOT NULL
  • name — character — NOT NULL
  • created_at — timestamp — NOT NULL

user_equipped_items

  • user_equipped_item_id — bigint — Primary key — NOT NULL
  • user_id — bigint — Foreign key → users.user_id — NOT NULL
  • item_category_id — bigint — Foreign key → item_categories.item_category_id — NOT NULL
  • item_id — bigint — Foreign key → items.item_id — NOT NULL
  • equipped_at — timestamp — NOT NULL

user_items

  • user_item_id — bigint — Primary key — NOT NULL
  • user_id — bigint — Foreign key → users.user_id — NOT NULL
  • item_id — bigint — Foreign key → items.item_id — NOT NULL
  • acquired_at — timestamp — NOT NULL
  • is_owned — boolean — NOT NULL

users

  • user_id — bigint — Primary key — NOT NULL
  • account_id — bigint — Foreign key → accounts.account_id — NOT NULL
  • nickname — character — NOT NULL
  • profile_image_url — character
  • kiwi_balance — integer — NOT NULL
  • created_at — timestamp — NOT NULL
  • updated_at — timestamp — NOT NULL