bon
Tables (27)
auth_sessions
- id — uuid — Primary key — NOT NULL
- member_id — uuid — Foreign key → members.id — NOT NULL
- refresh_token_hash — text — NOT NULL
- expires_at — timestamptz — NOT NULL
- revoked_at — timestamptz
- created_at — timestamptz — NOT NULL
badge_conditions
- metric_key — text — Primary key — NOT NULL
- badge_id — uuid — Foreign key → badges.id — NOT NULL
- threshold — bigint — NOT NULL
badges
- id — uuid — Primary key — NOT NULL
- category — badge_category — NOT NULL
- name — text — NOT NULL
- description — text — NOT NULL
- image_url — text
- condition_text — text — NOT NULL
- retired_at — timestamptz
card_characters
- id — uuid — Primary key — NOT NULL
- name — text — NOT NULL
- image_url — text — NOT NULL
card_themes
- id — uuid — Primary key — NOT NULL
- name — text — NOT NULL
- image_url — text — NOT NULL
citizen_cards
- id — uuid — Primary key — NOT NULL
- member_id — uuid — Foreign key → members.id — NOT NULL
- theme_id — uuid — Foreign key → card_themes.id — NOT NULL
- barcode_value — text — NOT NULL
- issued_at — timestamptz — NOT NULL
idempotency_requests
- idempotency_key — varchar(128) — Primary key — NOT NULL
- member_id — uuid — Foreign key → members.id — NOT NULL
- operation — text — NOT NULL
- request_hash — text — NOT NULL
- response_status — integer
- response_body — jsonb
- created_at — timestamptz — NOT NULL
- expires_at — timestamptz — NOT NULL
member_badges
- member_id — uuid — Foreign key → members.id — NOT NULL
- badge_id — uuid — Foreign key → badges.id — NOT NULL
- trip_id — uuid — Foreign key → trips.id — NOT NULL
- earned_at — timestamptz — NOT NULL
member_profiles
- member_id — uuid — Foreign key → members.id — NOT NULL
- display_name — varchar(8) — NOT NULL
- character_id — uuid — Foreign key → card_characters.id — NOT NULL
- updated_at — timestamptz — NOT NULL
member_settings
- member_id — uuid — Foreign key → members.id — NOT NULL
- nearby_quiz_notification_enabled — boolean — NOT NULL
- dark_mode_enabled — boolean — NOT NULL
- version — bigint — NOT NULL
members
- id — uuid — Primary key — NOT NULL
- status — member_status — NOT NULL
- created_at — timestamptz — NOT NULL
- withdrawn_at — timestamptz
- purge_after — timestamptz
mission_choices
- id — uuid — Primary key — NOT NULL
- mission_id — uuid — Foreign key → missions.id — NOT NULL
- label — text — NOT NULL
- correct — boolean — NOT NULL
- sort_order — integer — NOT NULL
mission_participations
- id — uuid — Primary key — NOT NULL
- trip_id — uuid — Foreign key → trips.id — NOT NULL
- mission_id — uuid — Foreign key → missions.id — NOT NULL
- status — mission_status — NOT NULL
- attempt_count — integer — NOT NULL
- completed_at — timestamptz
mission_photos
- id — uuid — Primary key — NOT NULL
- member_id — uuid — Foreign key → members.id — NOT NULL
- trip_id — uuid — Foreign key → trips.id — NOT NULL
- mission_id — uuid — Foreign key → missions.id — NOT NULL
- object_key — text — NOT NULL
- content_type — text — NOT NULL
- file_size_bytes — bigint — NOT NULL
- uploaded_at — timestamptz — NOT NULL
mission_submissions
- id — uuid — Primary key — NOT NULL
- participation_id — uuid — Foreign key → mission_participations.id — NOT NULL
- type — mission_type — NOT NULL
- choice_id — uuid — Foreign key → mission_choices.id
- ox_answer — boolean
- photo_id — uuid — Foreign key → mission_photos.id
- correct — boolean — NOT NULL
- submitted_at — timestamptz — NOT NULL
missions
- id — uuid — Primary key — NOT NULL
- place_id — uuid — Foreign key → places.id — NOT NULL
- type — mission_type — NOT NULL
- title — text — NOT NULL
- description — text — NOT NULL
- reward_points — integer — NOT NULL
- max_attempts — integer
- ox_correct_answer — boolean
notifications
- id — uuid — Primary key — NOT NULL
- member_id — uuid — Foreign key → members.id — NOT NULL
- type — notification_type — NOT NULL
- title — text — NOT NULL
- body — text — NOT NULL
- read_at — timestamptz
- target_type — text
- target_id — uuid
- occurred_at — timestamptz — NOT NULL
places
- id — uuid — Primary key — NOT NULL
- category — place_category — NOT NULL
- name — text — NOT NULL
- summary — text
- description — text
- address — text
- image_url — text
- location — geography(Point, 4326) — NOT NULL
- source_name — text
- source_url — text
point_settlements
- id — uuid — Primary key — NOT NULL
- trip_id — uuid — Foreign key → trips.id — NOT NULL
- choice — settlement_choice — NOT NULL
- settled_points — bigint — NOT NULL
- expires_at — timestamptz
- settled_at — timestamptz — NOT NULL
point_transactions
- id — uuid — Primary key — NOT NULL
- member_id — uuid — Foreign key → members.id — NOT NULL
- trip_id — uuid — Foreign key → trips.id
- participation_id — uuid — Foreign key → mission_participations.id
- type — point_transaction_type — NOT NULL
- amount — bigint — NOT NULL
- description — text — NOT NULL
- occurred_at — timestamptz — NOT NULL
push_tokens
- auth_session_id — uuid — Foreign key → auth_sessions.id — NOT NULL
- registration_token — text — NOT NULL
- created_at — timestamptz — NOT NULL
- updated_at — timestamptz — NOT NULL
saved_places
- member_id — uuid — Foreign key → members.id — NOT NULL
- place_id — uuid — Foreign key → places.id — NOT NULL
- saved_at — timestamptz — NOT NULL
social_accounts
- id — uuid — Primary key — NOT NULL
- member_id — uuid — Foreign key → members.id — NOT NULL
- provider — social_provider — NOT NULL
- provider_subject — text — NOT NULL
- created_at — timestamptz — NOT NULL
term_consents
- member_id — uuid — Foreign key → members.id — NOT NULL
- term_id — uuid — Foreign key → terms.id — NOT NULL
- agreed — boolean — NOT NULL
- agreed_at — timestamptz — NOT NULL
terms
- id — uuid — Primary key — NOT NULL
- type — term_type — NOT NULL
- version — text — NOT NULL
- required — boolean — NOT NULL
- title — text — NOT NULL
- content — text — NOT NULL
- effective_at — timestamptz — NOT NULL
trips
- id — uuid — Primary key — NOT NULL
- member_id — uuid — Foreign key → members.id — NOT NULL
- status — trip_status — NOT NULL
- started_at — timestamptz — NOT NULL
- ended_at — timestamptz
- settled_at — timestamptz
visit_records
- id — uuid — Primary key — NOT NULL
- trip_id — uuid — Foreign key → trips.id — NOT NULL
- mission_id — uuid — Foreign key → missions.id — NOT NULL
- place_id — uuid — Foreign key → places.id — NOT NULL
- visited_at — timestamptz — NOT NULL