trip3

Tables (11)

ai_summaries

  • ai_summary_id — BIGINT — Primary key — NOT NULL
  • change_request_id — BIGINT — Foreign key → change_requests.change_request_id — NOT NULL
  • summary_text — TEXT
  • impacted_members — JSON
  • estimated_correction_amount — DECIMAL(18,2)
  • recommended_action — VARCHAR(255)
  • created_at — DATETIME — NOT NULL

change_requests

  • change_request_id — BIGINT — Primary key — NOT NULL
  • transaction_id — BIGINT — Foreign key → transactions.transaction_id — NOT NULL
  • requester_member_id — BIGINT — Foreign key → trip_members.trip_member_id — NOT NULL
  • type — VARCHAR(20) — NOT NULL
  • target_member_id — BIGINT — Foreign key → trip_members.trip_member_id
  • new_value — VARCHAR(255)
  • reason — VARCHAR(500)
  • status — VARCHAR(20) — NOT NULL
  • auto_rejected — BOOLEAN — NOT NULL
  • requested_at — DATETIME — NOT NULL
  • decided_at — DATETIME

member_nets

  • member_net_id — BIGINT — Primary key — NOT NULL
  • run_id — BIGINT — Foreign key → settlement_runs.run_id — NOT NULL
  • trip_member_id — BIGINT — Foreign key → trip_members.trip_member_id — NOT NULL
  • paid_amount — DECIMAL(18,2) — NOT NULL
  • owed_amount — DECIMAL(18,2) — NOT NULL
  • net_amount — DECIMAL(18,2) — NOT NULL

settlement_runs

  • run_id — BIGINT — Primary key — NOT NULL
  • trip_id — BIGINT — Foreign key → trips.trip_id — NOT NULL
  • seq_no — INT — NOT NULL
  • is_current — BOOLEAN
  • triggered_by_change_request_id — BIGINT — Foreign key → change_requests.change_request_id
  • calculated_at — DATETIME — NOT NULL

settlements

  • settlement_id — BIGINT — Primary key — NOT NULL
  • run_id — BIGINT — Foreign key → settlement_runs.run_id — NOT NULL
  • from_member_id — BIGINT — Foreign key → trip_members.trip_member_id — NOT NULL
  • to_member_id — BIGINT — Foreign key → trip_members.trip_member_id — NOT NULL
  • amount — DECIMAL(18,2) — NOT NULL
  • status — VARCHAR(20) — NOT NULL

transaction_corrections

  • correction_id — BIGINT — Primary key — NOT NULL
  • transaction_id — BIGINT — Foreign key → transactions.transaction_id — NOT NULL
  • change_request_id — BIGINT — Foreign key → change_requests.change_request_id — NOT NULL
  • target_share_id — BIGINT — Foreign key → transaction_shares.share_id — NOT NULL
  • correction_amount — DECIMAL(18,2) — NOT NULL
  • correction_rate — DECIMAL(18,6) — NOT NULL
  • status — VARCHAR(20) — NOT NULL
  • processed_at — DATETIME — NOT NULL

transaction_shares

  • share_id — BIGINT — Primary key — NOT NULL
  • transaction_id — BIGINT — Foreign key → transactions.transaction_id — NOT NULL
  • trip_member_id — BIGINT — Foreign key → trip_members.trip_member_id — NOT NULL
  • share_amount — DECIMAL(18,2) — NOT NULL
  • residual_holder — BOOLEAN — NOT NULL

transactions

  • transaction_id — BIGINT — Primary key — NOT NULL
  • trip_id — BIGINT — Foreign key → trips.trip_id — NOT NULL
  • type — VARCHAR(20) — NOT NULL
  • category — VARCHAR(30)
  • title — VARCHAR(200) — NOT NULL
  • payer_member_id — BIGINT — Foreign key → trip_members.trip_member_id — NOT NULL
  • payment_currency — CHAR(3) — NOT NULL
  • payment_amount — DECIMAL(18,2) — NOT NULL
  • payment_rate — DECIMAL(18,6) — NOT NULL
  • base_amount — DECIMAL(18,2) — NOT NULL
  • rate_source — VARCHAR(10) — NOT NULL
  • scope — VARCHAR(10) — NOT NULL
  • refund_policy — VARCHAR(255)
  • status — VARCHAR(20) — NOT NULL
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL

trip_members

  • trip_member_id — BIGINT — Primary key — NOT NULL
  • trip_id — BIGINT — Foreign key → trips.trip_id — NOT NULL
  • user_id — BIGINT — Foreign key → users.user_id
  • display_name — VARCHAR(100) — NOT NULL
  • role — VARCHAR(20) — NOT NULL
  • is_guest — BOOLEAN — NOT NULL
  • status — VARCHAR(20) — NOT NULL
  • joined_at — DATETIME — NOT NULL

trips

  • trip_id — BIGINT — Primary key — NOT NULL
  • owner_user_id — BIGINT — Foreign key → users.user_id
  • title — VARCHAR(200) — NOT NULL
  • country — VARCHAR(100)
  • base_currency — CHAR(3) — NOT NULL
  • start_date — DATE
  • end_date — DATE
  • status — VARCHAR(20) — NOT NULL
  • created_at — DATETIME — NOT NULL

users

  • user_id — BIGINT — Primary key — NOT NULL
  • email — VARCHAR(255) — NOT NULL
  • name — VARCHAR(100) — NOT NULL
  • created_at — DATETIME — NOT NULL