DB Structure & Core Data Model Blueprint
เอกสารฉบับนี้เป็นพิมพ์เขียวเชิงโครงสร้างข้อมูลสำหรับ Together Super App V2 โดยมีจุดประสงค์เพื่อทำให้สิ่งที่ถูกออกแบบไว้ใน prototype, screen logic, Together Mode, content architecture และระบบงานเชิงธุรกิจ สามารถเชื่อมกันบนฐานข้อมูลและ model กลางชุดเดียวได้อย่างเป็นระบบ
เอกสารนี้ไม่ใช่เพียงรายการตารางฐานข้อมูล แต่เป็น “แบบจำลองแกนกลางของแพลตฟอร์ม” ที่ใช้ร่วมกันระหว่าง:
- ทีมออกแบบ
- ทีมพัฒนา
- ทีม content
- ทีม integration
- ทีม analytics
- ทีม product / solution
- ทีม test / QA / UAT
แกนคิดสำคัญคือการทำให้ทุกหน้าจอ ทุก block ทุก flow ทุก content item และทุก service สามารถอ้างอิงกลับมายัง object model ชุดเดียวกันได้
เพื่อให้แพลตฟอร์มไม่กระจายเป็นงานเฉพาะหน้า แต่เติบโตเป็นระบบที่ประกอบ ขยาย เชื่อม และวัดผลได้จริง
1. หลักคิดของ Core Data Model
Core Data Model ของ Together Super App V2 ต้องตอบโจทย์พร้อมกัน 4 ชั้น คือ:
- Platform Structure Layer
ใช้เก็บโครงของแพลตฟอร์ม เช่น mode, screen, block, journey, service
- Business Domain Layer
ใช้เก็บ domain จริงของธุรกิจ เช่น event, venue, hotel, merchant, reward, campaign, user, operator
- Content & Presentation Layer
ใช้เก็บ content item, localization, media asset, content-to-block mapping, UI-config-driven slots
- Tracking & Intelligence Layer
ใช้เก็บพฤติกรรม, event logs, funnel, conversion signals, recommendation input, KPI outputs
ถ้าไม่มีการแยก 4 ชั้นนี้ชัด ระบบจะเริ่มปะปนกัน เช่น:
- เอา content logic ไปปนกับ event entity
- เอา reward logic ไปปนกับ UI state
- เอา tracking logic ไป hardcode ในหน้าจอ
- เอา block configuration ไปฝังใน code มากเกินไป
ดังนั้นโครงฐานข้อมูลควรออกแบบให้ “รองรับการเปลี่ยนแปลง” ไม่ใช่แค่ “เก็บข้อมูลได้”
2. หลักการออกแบบฐานข้อมูลของ Together Super App V2
2.1 Mode-aware
ทุก object ที่เกี่ยวกับการแสดงผลควรมีความสัมพันธ์กับ mode ได้
อย่างน้อยในระดับ:
- directly bound
- optionally visible
- recommended in mode
- hidden in mode
โหมดหลักที่ยืนยันใช้คือ:
- Trip
- MICE
- Rewards
- Shopping
- Services
- Stay
2.2 Screen-to-Block-to-Content
หน้าจอไม่ควรผูก content แบบ hardcoded ทั้งหมด
แต่ควรมีชั้น mapping:
screen → block → content mapping → content item
2.3 Configurable before custom code
สิ่งที่ลูกค้าเปลี่ยนบ่อย เช่น:
- hero content
- quick actions
- featured sections
- category ranking
- campaign visibility
- role visibility
ควรอยู่ใน config/data model ก่อนเสมอ
2.4 Domain-first, UI-aware
ฐานข้อมูลควรเริ่มจาก domain model จริงก่อน
แต่ต้องออกแบบให้รองรับการ render บน UI ได้ดี
ไม่ใช่เก็บแบบ normalized จน UI ใช้ยากเกินไป
และไม่ใช่ denormalized จน maintain ยาก
2.5 Tracking-ready by design
ต้องมี key และ structure ที่พร้อมรองรับ tracking ตั้งแต่ต้น
เช่น:
- entity_id
- screen_id
- block_id
- mode_id
- campaign_id
- tenant_id
- user_id
- session_id
3. Core Entity Families
Core entities ของแพลตฟอร์มควรถูกแบ่งเป็น 10 families
- Platform Structure
- Experience & Navigation
- Content & Media
- Identity & Access
- MICE Domain
- Trip / Stay / Shopping Domain
- Rewards & Campaign Domain
- Services & Support Domain
- Commerce & Transaction Domain
- Tracking & Intelligence Domain
4. Platform Structure Tables
4.1 modes
เก็บรายการ Together Modes
ฟิลด์แนะนำ:
- mode_id
- mode_code
- mode_name_en
- mode_name_th
- description_en
- description_th
- icon_key
- color_theme
- sort_order
- is_active
ตัวอย่าง mode_code:
- trip
- mice
- rewards
- shopping
- services
- stay
4.2 screens
เก็บรายการหน้าจอทั้งหมด
ฟิลด์แนะนำ:
- screen_id
- screen_code
- screen_name
- platform_type
- route_path
- purpose
- mode_scope
- owner_team
- status
- sort_order
- is_active
4.3 screen_modes
mapping ว่าหน้าจอใดใช้กับ mode ใด
เพราะบางหน้าจออาจ:
- ใช้เฉพาะ mode เดียว
- ใช้หลาย mode
- ใช้ทุก mode แต่ priority ต่างกัน
ฟิลด์:
- screen_mode_id
- screen_id
- mode_id
- visibility_type
- ranking_weight
4.4 blocks
เก็บรายการ block / component หลักในแต่ละหน้าจอ
ฟิลด์:
- block_id
- screen_id
- block_code
- block_name
- block_type
- layout_zone
- sort_order
- content_type
- is_reusable
- state_model
- is_active
4.5 journeys
เก็บ flow หลักของผู้ใช้
ฟิลด์:
- journey_id
- journey_code
- journey_name
- description
- user_type
- primary_mode_id
- entry_screen_id
- success_condition
- is_active
4.6 journey_steps
เก็บลำดับ step ของแต่ละ journey
ฟิลด์:
- journey_step_id
- journey_id
- step_no
- screen_id
- block_id
- action_type
- expected_output
- failure_path
4.7 services
เก็บรายการบริการใน platform
ฟิลด์:
- service_id
- service_code
- service_name_en
- service_name_th
- category_id
- description
- tier_basic
- tier_premium
- tier_enterprise
- priority_level
- readiness_level
- technical_complexity
- is_active
4.8 service_categories
เก็บหมวดบริการ
ฟิลด์:
- category_id
- category_code
- category_name_en
- category_name_th
- sort_order
5. Content & Media Tables
5.1 content_items
เก็บ content กลางทุกชนิด
ฟิลด์:
- content_id
- content_code
- content_type
- title_en
- title_th
- subtitle_en
- subtitle_th
- body_en
- body_th
- summary_en
- summary_th
- content_status
- source_type
- owner_user_id
- reviewer_user_id
- approver_user_id
- publish_at
- expire_at
- is_active
5.2 content_localizations
ใช้รองรับหลายภาษาแบบขยายได้
ฟิลด์:
- localization_id
- content_id
- locale_code
- title
- subtitle
- body
- summary
- seo_title
- seo_description
5.3 media_assets
เก็บไฟล์ภาพ วิดีโอ เอกสาร ไอคอน ฯลฯ
ฟิลด์:
- media_id
- media_type
- file_url
- thumbnail_url
- alt_text_en
- alt_text_th
- caption_en
- caption_th
- mime_type
- file_size
- width
- height
- duration_sec
- owner_user_id
- is_active
5.4 content_media_mapping
mapping content กับ media
ฟิลด์:
- content_media_id
- content_id
- media_id
- usage_type
- sort_order
- is_primary
5.5 content_block_mapping
mapping ว่า content ไหนขึ้น block ไหน
ฟิลด์:
- content_block_map_id
- content_id
- block_id
- mode_id
- priority_weight
- display_rule
- start_at
- end_at
- is_featured
- is_active
5.6 tags
เก็บ tag กลาง
ฟิลด์:
- tag_id
- tag_code
- tag_name
- tag_group
- is_active
5.7 content_tags
mapping content กับ tag
ฟิลด์:
- content_tag_id
- content_id
- tag_id
6. Identity & Access Tables
6.1 users
เก็บผู้ใช้
ฟิลด์:
- user_id
- external_ref
- email
- phone
- display_name
- first_name
- last_name
- user_status
- preferred_language
- created_at
- updated_at
6.2 roles
เก็บ role
ฟิลด์:
- role_id
- role_code
- role_name
- role_scope
- is_active
ตัวอย่าง:
- attendee
- organizer
- operator
- sponsor
- exhibitor
- admin
- tenant_admin
- support_agent
6.3 permissions
เก็บ permission รายการ
ฟิลด์:
- permission_id
- permission_code
- permission_name
- resource_type
- action_type
6.4 role_permissions
mapping role กับ permission
ฟิลด์:
- role_permission_id
- role_id
- permission_id
6.5 user_roles
mapping user กับ role
ฟิลด์:
- user_role_id
- user_id
- role_id
- tenant_id
- start_at
- end_at
- is_active
6.6 tenants
รองรับ multi-tenant
ฟิลด์:
- tenant_id
- tenant_code
- tenant_name
- tenant_type
- brand_name
- default_language
- status
- created_at
6.7 tenant_settings
เก็บ setting ของแต่ละ tenant
ฟิลด์:
- tenant_setting_id
- tenant_id
- setting_key
- setting_value_json
- updated_at
7. MICE Domain Tables
7.1 events
เก็บงานอีเวนต์หลัก
ฟิลด์:
- event_id
- tenant_id
- event_code
- event_name_en
- event_name_th
- description_en
- description_th
- event_type
- start_datetime
- end_datetime
- status
- venue_id
- organizer_user_id
- is_public
7.2 event_days
เก็บวันของงาน
ฟิลด์:
- event_day_id
- event_id
- day_no
- date_value
- label_en
- label_th
7.3 sessions
เก็บ session ใน agenda
ฟิลด์:
- session_id
- event_id
- event_day_id
- session_code
- title_en
- title_th
- summary_en
- summary_th
- description_en
- description_th
- start_datetime
- end_datetime
- room_id
- track_code
- capacity
- session_status
7.4 speakers
เก็บวิทยากร
ฟิลด์:
- speaker_id
- full_name
- title_en
- title_th
- organization_en
- organization_th
- bio_en
- bio_th
- avatar_media_id
- status
7.5 session_speakers
mapping session กับ speaker
ฟิลด์:
- session_speaker_id
- session_id
- speaker_id
- role_in_session
- sort_order
7.6 exhibitors
เก็บ exhibitor
ฟิลด์:
- exhibitor_id
- event_id
- exhibitor_code
- exhibitor_name_en
- exhibitor_name_th
- description_en
- description_th
- booth_code
- category_code
- logo_media_id
- website_url
- status
7.7 sponsors
เก็บ sponsor
ฟิลด์:
- sponsor_id
- event_id
- sponsor_code
- sponsor_name_en
- sponsor_name_th
- sponsor_tier
- description_en
- description_th
- logo_media_id
- website_url
- status
7.8 venues
เก็บ venue หลัก
ฟิลด์:
- venue_id
- venue_code
- venue_name_en
- venue_name_th
- description_en
- description_th
- address_en
- address_th
- latitude
- longitude
- venue_type
- status
7.9 venue_zones
เก็บ hall / room / zone
ฟิลด์:
- zone_id
- venue_id
- zone_code
- zone_name_en
- zone_name_th
- zone_type
- floor_no
- parent_zone_id
- map_ref
- capacity
7.10 registrations
เก็บข้อมูลลงทะเบียนเข้างาน
ฟิลด์:
- registration_id
- event_id
- user_id
- registration_type
- badge_type
- registration_status
- approval_status
- registered_at
- approved_at
- qr_code_value
7.11 checkins
เก็บ check-in จริง
ฟิลด์:
- checkin_id
- registration_id
- event_id
- user_id
- checkin_time
- checkin_point
- checkin_method
8. Trip / Stay / Shopping Domain Tables
8.1 places
เก็บสถานที่ท่องเที่ยว จุดสนใจ ร้าน หรือ landmark
ฟิลด์:
- place_id
- place_code
- place_name_en
- place_name_th
- place_type
- description_en
- description_th
- latitude
- longitude
- district_code
- address_en
- address_th
- hero_media_id
- status
8.2 routes
เก็บ route หรือ itinerary template
ฟิลด์:
- route_id
- route_code
- route_name_en
- route_name_th
- description_en
- description_th
- duration_type
- difficulty_level
- mode_fit_json
- is_featured
8.3 route_stops
จุดแวะของ route
ฟิลด์:
- route_stop_id
- route_id
- place_id
- stop_no
- recommended_duration_min
- note_en
- note_th
8.4 itineraries
แผนเที่ยวของผู้ใช้
ฟิลด์:
- itinerary_id
- user_id
- itinerary_name
- trip_date
- status
- created_at
- updated_at
8.5 itinerary_items
รายการในแผนเที่ยว
ฟิลด์:
- itinerary_item_id
- itinerary_id
- place_id
- route_id
- start_time
- end_time
- sort_order
- item_status
8.6 hotels
เก็บข้อมูลที่พัก
ฟิลด์:
- hotel_id
- hotel_code
- hotel_name_en
- hotel_name_th
- description_en
- description_th
- star_rating
- latitude
- longitude
- district_code
- hero_media_id
- status
8.7 hotel_offers
เก็บโปรโมชันหรือข้อเสนอห้องพัก
ฟิลด์:
- hotel_offer_id
- hotel_id
- offer_code
- offer_title_en
- offer_title_th
- description_en
- description_th
- start_at
- end_at
- price_from
- currency_code
- booking_url
- status
8.8 merchants
เก็บร้านค้า/ผู้ประกอบการ
ฟิลด์:
- merchant_id
- merchant_code
- merchant_name_en
- merchant_name_th
- merchant_type
- description_en
- description_th
- latitude
- longitude
- district_code
- logo_media_id
- status
8.9 products
เก็บสินค้า
ฟิลด์:
- product_id
- merchant_id
- product_code
- product_name_en
- product_name_th
- category_code
- description_en
- description_th
- price
- currency_code
- hero_media_id
- status
8.10 offers
เก็บ offer กลาง
ฟิลด์:
- offer_id
- offer_code
- offer_type
- title_en
- title_th
- description_en
- description_th
- owner_entity_type
- owner_entity_id
- start_at
- end_at
- status
9. Rewards & Campaign Domain Tables
9.1 wallets
เก็บกระเป๋า point/reward ของผู้ใช้
ฟิลด์:
- wallet_id
- user_id
- wallet_type
- point_balance
- status
- updated_at
9.2 wallet_transactions
เก็บธุรกรรมแต้ม
ฟิลด์:
- wallet_tx_id
- wallet_id
- transaction_type
- amount
- source_type
- source_id
- balance_after
- created_at
9.3 campaigns
เก็บ campaign
ฟิลด์:
- campaign_id
- campaign_code
- campaign_name_en
- campaign_name_th
- campaign_type
- description_en
- description_th
- start_at
- end_at
- owner_tenant_id
- status
9.4 missions
เก็บภารกิจ
ฟิลด์:
- mission_id
- campaign_id
- mission_code
- mission_name_en
- mission_name_th
- description_en
- description_th
- reward_type
- reward_value
- mission_rule_json
- status
9.5 user_missions
เก็บความคืบหน้าภารกิจของผู้ใช้
ฟิลด์:
- user_mission_id
- mission_id
- user_id
- mission_status
- progress_value
- completed_at
- reward_issued_at
9.6 vouchers
เก็บ voucher
ฟิลด์:
- voucher_id
- voucher_code
- campaign_id
- voucher_type
- title_en
- title_th
- description_en
- description_th
- value_type
- value_amount
- start_at
- end_at
- status
9.7 redemptions
เก็บการแลกสิทธิ์
ฟิลด์:
- redemption_id
- voucher_id
- user_id
- redeemed_at
- redemption_status
- merchant_id
- redemption_ref
10. Services & Support Domain Tables
10.1 support_cases
เก็บเคส support
ฟิลด์:
- case_id
- user_id
- case_code
- case_type
- subject
- description
- priority_level
- case_status
- assigned_user_id
- created_at
- closed_at
10.2 service_requests
เก็บคำร้อง service อื่น ๆ
ฟิลด์:
- service_request_id
- user_id
- service_type
- request_payload_json
- request_status
- created_at
- updated_at
10.3 esim_packages
เก็บ package eSIM
ฟิลด์:
- esim_package_id
- package_code
- package_name_en
- package_name_th
- data_quota
- duration_days
- price
- currency_code
- status
10.4 insurance_plans
เก็บแผนประกัน
ฟิลด์:
- insurance_plan_id
- plan_code
- plan_name_en
- plan_name_th
- description_en
- description_th
- coverage_summary_en
- coverage_summary_th
- price
- currency_code
- status
10.5 transport_nodes
เก็บ node ด้าน transport
ฟิลด์:
- transport_node_id
- node_code
- node_name_en
- node_name_th
- node_type
- latitude
- longitude
- district_code
- status
11. Commerce & Transaction Tables
11.1 orders
เก็บคำสั่งซื้อ
ฟิลด์:
- order_id
- user_id
- merchant_id
- order_code
- order_status
- subtotal_amount
- discount_amount
- total_amount
- currency_code
- created_at
- paid_at
11.2 order_items
เก็บรายการสินค้าใน order
ฟิลด์:
- order_item_id
- order_id
- product_id
- quantity
- unit_price
- line_total
11.3 payments
เก็บการชำระเงิน
ฟิลด์:
- payment_id
- order_id
- payment_method
- payment_status
- paid_amount
- currency_code
- payment_ref
- paid_at
11.4 sponsorship_packages
เก็บ package sponsor/exhibitor
ฟิลด์:
- sponsorship_package_id
- event_id
- package_code
- package_name_en
- package_name_th
- entitlement_json
- price
- currency_code
- status
12. Tracking & Intelligence Tables
12.1 tracking_sessions
เก็บ session การใช้งาน
ฟิลด์:
- tracking_session_id
- user_id
- anonymous_id
- started_at
- ended_at
- device_type
- platform_type
- app_version
- tenant_id
12.2 tracking_events
เก็บ event พฤติกรรม
ฟิลด์:
- tracking_event_id
- tracking_session_id
- user_id
- mode_id
- screen_id
- block_id
- entity_type
- entity_id
- event_name
- event_value
- event_payload_json
- occurred_at
ตัวอย่าง event_name:
- mode_selected
- screen_viewed
- block_clicked
- search_submitted
- itinerary_saved
- registration_started
- registration_completed
- checkin_completed
- reward_redeemed
- hotel_opened
- product_opened
- support_requested
12.3 screen_views
ถ้าต้องการ table สรุปแยก
ฟิลด์:
- screen_view_id
- tracking_session_id
- user_id
- mode_id
- screen_id
- viewed_at
- duration_sec
12.4 searches
เก็บคำค้นหา
ฟิลด์:
- search_id
- tracking_session_id
- user_id
- mode_id
- query_text
- result_count
- selected_entity_type
- selected_entity_id
- searched_at
12.5 conversions
เก็บ conversion สำคัญ
ฟิลด์:
- conversion_id
- user_id
- conversion_type
- source_event_id
- source_entity_type
- source_entity_id
- conversion_value
- converted_at
13. Relationship Blueprint ระดับภาพรวม
ความสัมพันธ์ระดับแกนควรเป็นดังนี้:
- mode 1—N screens ผ่าน screen_modes
- screen 1—N blocks
- journey 1—N journey_steps
- block N—N content_items ผ่าน content_block_mapping
- content_items N—N media_assets ผ่าน content_media_mapping
- users N—N roles ผ่าน user_roles
- roles N—N permissions ผ่าน role_permissions
- tenant 1—N users / events / campaigns / screens (ในบาง deployment)
- event 1—N sessions / exhibitors / sponsors / registrations
- venue 1—N zones
- hotel 1—N offers
- merchant 1—N products
- wallet 1—N wallet_transactions
- campaign 1—N missions / vouchers
- voucher 1—N redemptions
- tracking_session 1—N tracking_events / screen_views / searches
14. Mapping Between DB and Prototype / Design Management
14.1 Screen Registry → screens
screen registry ใน design management ควร map ตรงกับตาราง screens
14.2 Block Registry → blocks
block registry ควร map ตรงกับตาราง blocks
14.3 Journey Registry → journeys + journey_steps
journey registry ควร map ลง 2 ตารางนี้โดยตรง
14.4 Content Mapping → content_items + content_block_mapping
สิ่งที่ออกแบบใน prototype ว่ากล่องไหนขึ้น content อะไร ต้อง map ลง 2 ตารางนี้
14.5 Service Catalog → services + service_categories
เอกสาร MICE 84-Service Master Catalog ควรถูก map ลง services และ service_categories ได้ในอนาคต
14.6 Tracking Framework → tracking_events
event taxonomy ที่กำหนดใน tracking framework ต้อง map ลง tracking_events ได้ตรง
15. Mapping กับ Together Mode Architecture
เอกสาร Together Mode Architecture for Super App V2 ต้อง map เข้าฐานข้อมูลอย่างน้อยดังนี้
Trip Mode
เชื่อมกับ:
- places
- routes
- route_stops
- itineraries
- itinerary_items
- hotels
- hotel_offers
- transport_nodes
- tracking_events
MICE Mode
เชื่อมกับ:
- events
- event_days
- sessions
- speakers
- exhibitors
- sponsors
- venues
- venue_zones
- registrations
- checkins
- sponsorship_packages
- tracking_events
Rewards Mode
เชื่อมกับ:
- wallets
- wallet_transactions
- campaigns
- missions
- user_missions
- vouchers
- redemptions
- tracking_events
เชื่อมกับ:
- merchants
- products
- offers
- orders
- order_items
- payments
- tracking_events
Services Mode
เชื่อมกับ:
- support_cases
- service_requests
- esim_packages
- insurance_plans
- transport_nodes
- tracking_events
Stay Mode
เชื่อมกับ:
- hotels
- hotel_offers
- offers
- bookings (ถ้ามีในระยะถัดไป)
- tracking_events
16. ข้อเสนอเรื่อง Normalization / Denormalization
ควร normalized ในชั้น core
เช่น:
- users
- roles
- permissions
- events
- sessions
- hotels
- merchants
- products
- campaigns
- vouchers
ควรมี denormalized view / cache layer สำหรับ UI
เช่น:
- home mode feed
- event home summary
- reward dashboard summary
- hotel card aggregate
- product card aggregate
- nearby place summary
เหตุผลคือ:
- core tables ต้องรักษาความถูกต้อง
- UI feed ต้องตอบเร็วและพร้อม render
ดังนั้นควรแยก:
- source-of-truth tables
- serving/read model tables หรือ cached API outputs
17. สิ่งที่ควรเตรียมสำหรับ API Layer
ทุก entity สำคัญควรรองรับ:
- list
- detail
- search
- filter
- sort
- related-items
- mode-aware ranking
ตัวอย่าง API family:
- /modes
- /screens
- /content
- /events
- /sessions
- /speakers
- /exhibitors
- /venues
- /places
- /routes
- /hotels
- /merchants
- /products
- /campaigns
- /missions
- /vouchers
- /wallet
- /support
- /tracking
18. สิ่งที่ควรเผื่อไว้สำหรับ Enterprise
Enterprise tier ต้องการมากกว่าการมีตารางเพิ่ม
แต่ต้องการ schema ที่รองรับ:
- multi-tenant isolation
- tenant-specific branding
- tenant-specific content visibility
- role-based access
- service composition
- page / block composition
- configurable workflows
- integration connector fields
- audit-ready structure
ดังนั้น field ที่ควรเผื่อไว้ในหลายตารางคือ:
- tenant_id
- visibility_scope
- config_json
- external_ref
- status
- owner_user_id
- updated_at
- created_at
19. ตัวอย่างกลุ่ม schema สำหรับเริ่มต้นจริง
Phase 1 — Foundation Schema
- modes
- screens
- screen_modes
- blocks
- journeys
- journey_steps
- users
- roles
- permissions
- user_roles
- content_items
- content_block_mapping
- media_assets
- tracking_sessions
- tracking_events
Phase 2 — MICE + Trip + Rewards Core
- events
- event_days
- sessions
- speakers
- exhibitors
- sponsors
- venues
- venue_zones
- registrations
- checkins
- places
- routes
- route_stops
- itineraries
- itinerary_items
- wallets
- wallet_transactions
- campaigns
- missions
- user_missions
- vouchers
- redemptions
Phase 3 — Stay + Shopping + Services + Commerce
- hotels
- hotel_offers
- merchants
- products
- offers
- orders
- order_items
- payments
- support_cases
- service_requests
- esim_packages
- insurance_plans
- sponsorship_packages
Phase 4 — Enterprise & Intelligence
- tenants
- tenant_settings
- content_localizations
- tags
- content_tags
- conversions
- searches
- screen_views
- denormalized serving views
- recommendation feature tables
- audit / event logs เพิ่มเติม
20. สรุปเชิงยุทธศาสตร์
DB Structure & Core Data Model Blueprint ฉบับนี้มีบทบาทสำคัญมาก เพราะเป็นจุดที่ทำให้:
- prototype ไม่ลอย
- design management ไม่ค้างอยู่แค่เอกสาร
- content ไม่กระจัดกระจาย
- mode filtering ไม่ hardcode
- integration ไม่แก้ซ้ำ
- tracking ไม่ต้องมาปะทีหลัง
- enterprise extension ไม่ต้องรื้อ schema ใหม่ทั้งหมด
เอกสารฉบับนี้ควรถูกใช้ร่วมกับ:
- MICE 84-Service Master Catalog
- Together Mode Architecture for Super App V2
- Prototype Design Readiness & System Blueprint
เมื่อใช้ร่วมกันครบ จะได้ชุดเอกสารที่เชื่อมกันดังนี้:
- เอกสารด้าน service → บอกว่ามี “อะไร”
- เอกสารด้าน mode / UX → บอกว่า “แสดงอย่างไร”
- เอกสารด้าน readiness / management → บอกว่า “พัฒนาอย่างไร”
- เอกสารด้าน DB / model → บอกว่า “เก็บและเชื่อมอย่างไร”
ท้ายที่สุด เอกสารฉบับนี้คือสะพานระหว่าง “ภาพของระบบ” กับ “โครงของระบบ”
และเป็นฐานที่ทำให้ Together Super App V2 สามารถขยับจาก design-led prototype ไปสู่ platform ที่ build ได้จริง, integrate ได้จริง, และ scale ได้จริง
Claude-added · Cross-links + Appendix
ส่วนนี้ ไม่ใช่ ข้อความของ ChatGPT · Claude เพิ่มเพื่อเชื่อมเอกสารเข้าระบบ marketing library · สามารถลบได้โดยไม่กระทบเนื้อหาหลัก.
ตำแหน่งของเอกสารนี้ใน Marketing track:
เอกสารนี้เชื่อมกับ Marketing #4/#5/#6 อย่างไร (ตามที่ §14 + §15 + §20 ของ primary source ระบุ):
- Doc #4 · MICE 84-Service Master Catalog — §4.7
services + §4.8 service_categories คือ database target สำหรับ 84 services ใน 8 หมวด · ฟิลด์ tier_basic / tier_premium / tier_enterprise / priority_level / readiness_level / technical_complexity map ตรง 1-1 กับ schema ที่ Doc #4 วางไว้ · เอกสารด้าน service → บอกว่ามี "อะไร" · เอกสารนี้ → บอกว่า "เก็บอย่างไร".
- Doc #5 · Together Mode Architecture V2 — §15 ของ Doc #7 map ทั้ง 6 modes (Trip / MICE / Rewards / Shopping / Services / Stay) เข้ากับชุดตารางเฉพาะ mode นั้น ๆ · §2.1 Mode-aware principle (directly bound / optionally visible / recommended in mode / hidden in mode) implement ผ่าน
screen_modes.visibility_type + content_block_mapping.mode_id.
- Doc #6 · Prototype Design Readiness & System Blueprint — §14 map registries ของ Doc #6 ลง database tables ตรง ๆ: Screen Registry →
screens · Block Registry → blocks · Journey Registry → journeys + journey_steps · Content Mapping → content_items + content_block_mapping · Service Catalog → services + service_categories · Tracking Framework → tracking_events. Doc #6 §17-B2 DB groups (Platform / Content / MICE / Trip+Stay+Shopping / Rewards / Support / Identity / Tracking) map 1-1 กับ §4–§12 ของเอกสารนี้.
สรุปความสัมพันธ์ระหว่าง 4 เอกสารแกน (§20 primary source):
- Doc #4 (service) → บอกว่ามี "อะไร"
- Doc #5 (mode/UX) → บอกว่า "แสดงอย่างไร"
- Doc #6 (readiness/management) → บอกว่า "พัฒนาอย่างไร"
- Doc #7 (DB/model · this document) → บอกว่า "เก็บและเชื่อมอย่างไร"
Snapshot สถิติ (Claude นับจาก primary source · ไม่ใช่ข้อความ ChatGPT):
- 10 Entity Families (§3) — Platform Structure · Experience & Navigation · Content & Media · Identity & Access · MICE Domain · Trip/Stay/Shopping · Rewards & Campaign · Services & Support · Commerce · Tracking & Intelligence
- 70+ Tables แบ่งเป็น 9 section schemas: §4 (8 tables) · §5 (7) · §6 (7) · §7 (11) · §8 (10) · §9 (7) · §10 (5) · §11 (4) · §12 (5) = 64 core tables บวก supplementary ใน §19 Phase 4
- 4 Data Model Layers (§1) — Platform Structure / Business Domain / Content & Presentation / Tracking & Intelligence
- 6 Modes mapped (§15) — Trip/MICE/Rewards/Shopping/Services/Stay · each listing specific DB tables
- 4 Phases (§19) — Foundation → MICE+Trip+Rewards → Stay+Shopping+Services+Commerce → Enterprise+Intelligence
- 5 Design Principles (§2) — Mode-aware · Screen-to-Block-to-Content · Configurable before custom code · Domain-first UI-aware · Tracking-ready by design
- 19 API family endpoints (§17) — /modes /screens /content /events /sessions /speakers /exhibitors /venues /places /routes /hotels /merchants /products /campaigns /missions /vouchers /wallet /support /tracking
- 8 Enterprise-reserved fields (§18) — tenant_id · visibility_scope · config_json · external_ref · status · owner_user_id · updated_at · created_at
Forward hooks (งานถัดไปที่ schema นี้เตรียมทางไว้ให้):
- System Design & Integration Architecture — §17 API family เป็นโครง REST design · §18 Enterprise fields เตรียม multi-tenant isolation
- Content Operations & Publishing Model — §5 Content & Media tables (
content_items · content_localizations · content_block_mapping · tags) เป็นฐาน content ops ต่อได้ตรง
- Tracking Framework & KPI Matrix — §12 Tracking tables (
tracking_sessions · tracking_events · screen_views · searches · conversions) ตอบ taxonomy ของ Doc #6 §17-D1 (12 events) + D2 (KPI mapping per mode)
- Enterprise Canvas implementation — §7 MICE tables + §18 tenant fields +
content_block_mapping + sponsorship_packages ครอบคลุม use cases 5 ชุดของ Doc #3
Publisher note: Claude มีบทบาทเป็น ingester + formatter + indexer เท่านั้น · ไม่แก้ wording ของ ChatGPT primary source · ทำเฉพาะ: HTML conversion (markdown → HTML list + heading), anchor IDs (20 main sections + 60+ sub-sections), TOC, metadata block, field lists rendered เป็น compact 2-col grid เพื่อ readability (เก็บคำและลำดับต้นฉบับครบ), cross-links/appendix นี้, และ glossary ด้านล่าง · ข้อความต้นฉบับ preamble + §1–§20 ทุกตัวอักษรอยู่ครบไม่มีการลบหรือสรุป · ตารางและรายการฟิลด์ทุกตัวถูกยกมาจาก primary source ตรง ๆ.
Claude-added · Glossary (optional)
คำศัพท์ที่ปรากฏบ่อยในเอกสารนี้ · สรุปให้ผู้อ่านไม่ใช่ technical stakeholder · ไม่ใช่ ข้อความต้นฉบับของ ChatGPT.
Mode-aware
คุณสมบัติของ schema ที่ให้ทุก object แสดงผลได้แตกต่างตาม Together Mode ที่ user เลือก · มี 4 visibility levels: directly bound / optionally visible / recommended in mode / hidden in mode · implement ผ่าน screen_modes + content_block_mapping.mode_id — §2.1.
Content mapping
ชั้น data layer ที่ผูก content entity เข้ากับ block บนหน้าจอ · ไม่ hardcode ใน UI code · เปลี่ยนได้ runtime · ตาราง content_block_mapping เป็น source — §2.2, §5.5, §14.4.
Source-of-truth tables
ตารางที่เก็บข้อมูลต้นฉบับ normalized อย่างเคร่งครัด · เป็น authoritative record · ใช้สำหรับ write operations · เช่น users · events · hotels · products — §16.
Serving / read model
ตารางหรือ cached view ที่เก็บข้อมูล denormalized ไว้ serve UI ได้เร็ว · ไม่ใช่ authoritative · rebuild จาก source-of-truth ได้ · เช่น home mode feed / event home summary / hotel card aggregate — §16.
Tenant
ขอบเขตลูกค้า/แบรนด์/หน่วยงานที่ได้รับ deployment แยก · isolate identity + content + branding + role policy · ตาราง tenants + tenant_settings + field tenant_id ในหลายตาราง — §6.6, §18.
external_ref
ฟิลด์ reserved สำหรับเก็บ ID จากระบบภายนอก · รองรับ integration + data migration + sync back · เป็นส่วนหนึ่งของ Enterprise-ready fields — §18.
Conversion
event สำคัญทาง business ที่แสดงว่า user ทำสิ่งที่ platform ต้องการ · เช่น registration_completed · reward_redeemed · order completed · stored แยกจาก generic tracking_events เพื่อ funnel analysis — §12.5.
Denormalized view
ตารางหรือ materialized view ที่ aggregate + join ล่วงหน้าเพื่อลด query cost ตอน render · update ผ่าน batch job / cache refresh · ไม่เขียนตรง · อ่านอย่างเดียวจาก UI — §16.
4-Layer Data Model
Platform Structure + Business Domain + Content & Presentation + Tracking & Intelligence · แยกเพื่อไม่ปนกัน · §1 ของ primary source.
10 Entity Families
ชุดใหญ่ของตาราง 10 กลุ่ม · §3 · map 1-1 กับ §4–§12 section schemas.
Phase rollout (1-4)
ลำดับ implement schema · Phase 1 Foundation (mode/screen/block/user/content/tracking base) → Phase 2 MICE+Trip+Rewards core → Phase 3 Stay+Shopping+Services+Commerce → Phase 4 Enterprise+Intelligence — §19.
mode_fit_json
ฟิลด์ใน routes ที่ระบุว่า route นี้เข้ากับ mode ไหนบ้าง · เก็บเป็น JSON เพราะ 1 route อาจเหมาะกับหลาย mode พร้อม weight ต่างกัน — §8.2.