Dango ERD
Tables (24)
auth_passwords
- id — Primary key — NOT NULL
- user_no — BIGINT — Foreign key → users.user_no — NOT NULL
- salt — VARCHAR(255) — NOT NULL
- password — VARCHAR(255) — NOT NULL
- created_at — TIMESTAMPTZ — NOT NULL
- updated_at — TIMESTAMPTZ — NOT NULL
bookmarkable_coupon_templates
- coupon_template_id — BIGINT — Foreign key → coupon_templates.id — NOT NULL
- activation_type — bookmarkable_activation_type_enum — NOT NULL
- use_limit_per_user — bookmarkable_use_limit_enum — NOT NULL
- total_usage_limit — INT
- current_usage_count — INT — NOT NULL
coupon_template_analytics
- coupon_template_id — BIGINT — Foreign key → coupon_templates.id — NOT NULL — MVP에서는 실시간 업데이트, 추후 배치 업데이트로 전환
- total_bookmark_count — INT — NOT NULL
- current_bookmark_count — INT — NOT NULL
- total_issue_count — INT — NOT NULL
- total_usage_count — INT — NOT NULL
- last_issued_at — TIMESTAMP
- last_used_at — TIMESTAMP
coupon_template_versions
- id — BIGINT — Primary key — NOT NULL
- coupon_template_id — BIGINT — Foreign key → coupon_templates.id — NOT NULL
- version_no — INT
- version_start_at — DATETIME
- version_end_at — DATETIME
- template_snapshot — JSON
- created_at — TIMESTAMP
coupon_templates
- id — BIGINT — Primary key — NOT NULL
- version_no — INT — NOT NULL
- store_id — BIGINT — Foreign key → stores.id — NOT NULL
- policy_type — coupon_policy_type_enum — NOT NULL — BOOKMARKABLE, DOWNLOADABLE
- title — VARCHAR(255) — NOT NULL
- description — TEXT
- is_for_all_menu — BOOLEAN — NOT NULL — TRUE only for MVP
- customer_type — coupon_customer_type_enum — NOT NULL
- uses_per_person — INT — NOT NULL
- discount_type — coupon_discount_type_enum — NOT NULL
- value — INT — NOT NULL
- max_discount_amount — INT
- min_purchase_amount — INT — NOT NULL
- coupon_code — VARCHAR(100)
- coupon_template_status — coupon_template_status — NOT NULL — PENDING, ACTIVE, CANCELLED
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
customer_coupon_bookmarks
- id — BIGINT — Primary key — NOT NULL
- customer_id — BIGINT — Foreign key → user_customers.id — NOT NULL
- coupon_template_id — BIGINT — Foreign key → coupon_templates.id — NOT NULL
- bookmarked_at — TIMESTAMP — NOT NULL
customer_coupon_summary
- customer_id — BIGINT — Foreign key → user_customers.id — NOT NULL
- coupon_template_id — BIGINT — Foreign key → coupon_templates.id — NOT NULL
- is_bookmarked — BOOLEAN — NOT NULL
- issue_count — INT — NOT NULL
- usage_count — INT — NOT NULL
customer_coupons
- id — BIGINT — Primary key — NOT NULL
- customer_id — BIGINT — Foreign key → user_customers.id — NOT NULL
- coupon_template_version_id — BIGINT — Foreign key → coupon_template_versions.id — NOT NULL
- coupon_template_id — BIGINT — Foreign key → coupon_templates.id — NOT NULL
- title — VARCHAR(255) — NOT NULL
- description — TEXT
- discount_type — coupon_discount_type_enum — NOT NULL
- value — INT — NOT NULL
- min_purchase_amount — INT — NOT NULL
- valid_from — TIMESTAMP
- valid_to — TIMESTAMP
- status — customer_coupon_status_enum — NOT NULL
- issued_at — TIMESTAMP — NOT NULL
- used_at — TIMESTAMP
customer_locations
- id — BIGINT — Primary key — NOT NULL
- customer_id — BIGINT — Foreign key → user_customers.id — NOT NULL
- alias — VARCHAR(100)
- address — VARCHAR(255)
- address_line1 — VARCHAR(255)
- address_line2 — VARCHAR(255)
- city — VARCHAR(100)
- province — VARCHAR(100)
- postal_code — VARCHAR(20)
- country — VARCHAR(50)
- latitude — DECIMAL(10,7)
- longitude — DECIMAL(10,7)
- is_primary — BOOLEAN
- created_at — DATETIME
- updated_at — DATETIME
downloadable_coupon_templates
- coupon_template_id — BIGINT — Foreign key → coupon_templates.id — NOT NULL
- total_issue_limit — INT — NOT NULL
- current_issue_count — INT — NOT NULL
- issue_start_date — TIMESTAMP
- issue_end_date — TIMESTAMP
- validity_type — downloadable_validity_type_enum — NOT NULL
- validity_period_days — INT
- valid_from — TIMESTAMP
- valid_to — TIMESTAMP
log_user_activities
- id — BIGINT — Primary key — NOT NULL
- user_no — BIGINT — Foreign key → users.user_no — NOT NULL
- user_id — BIGINT
- ip_address — VARCHAR(100)
- user_agent — TEXT
- session_id — VARCHAR(255)
- module_name — VARCHAR(100)
- action_type — VARCHAR(100)
- table_name — VARCHAR(100)
- row_id — BIGINT
- status — log_status_enum — NOT NULL
- additional_data — JSON
- created_at — TIMESTAMP — NOT NULL
log_user_logins
- id — BIGINT — Primary key — NOT NULL
- user_no — BIGINT — Foreign key → users.user_no — NOT NULL
- event_type — VARCHAR(100)
- ip_address — VARCHAR(100)
- user_agent — TEXT
- session_id — VARCHAR(255)
- status — log_login_status_enum — NOT NULL
- log — TEXT
- created_at — TIMESTAMP — NOT NULL
recurring_schedules
- coupon_template_id — BIGINT — Foreign key → bookmarkable_coupon_templates.coupon_template_id — NOT NULL
- recurrence_type — recurrence_type_enum — NOT NULL
- recurrence_index — INT
- start_time — TIME
- end_time — TIME
- start_date — DATE
- end_date — DATE
store_news (store_posts)
- id — BIGINT — Primary key — NOT NULL
- store_id — BIGINT — Foreign key → stores.id — NOT NULL
- title — VARCHAR(255) — NOT NULL
- content — TEXT — NOT NULL
- status — ENUM('DRAFT','PUBLISHED','DELETED') — NOT NULL
- is_pinned — TINYINT(1) — NOT NULL
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- published_at — TIMESTAMP
store_news_images (store_post_images)
- id — BIGINT — Primary key — NOT NULL
- store_news_id — BIGINT — Foreign key → store_news.id — NOT NULL
- image_url — VARCHAR(1024) — NOT NULL
- display_order — INT — NOT NULL
- created_at — TIMESTAMP — NOT NULL
stores
- id — BIGINT — Primary key — NOT NULL
- merchant_id — BIGINT — Foreign key → user_merchants.id — NOT NULL
- store_name — VARCHAR(255)
- description — TEXT
- address — VARCHAR(1024)
- thumb_image_url — VARCHAR(2048)
- primary_coupon_template_id — BIGINT — Foreign key → coupon_templates.id
- created_at — TIMESTAMPTZ — NOT NULL
- updated_at — TIMESTAMPTZ — NOT NULL
terms
- id — Primary key — NOT NULL
- version — VARCHAR(255) — NOT NULL
- content — TEXT
- is_mandatory — BOOLEAN — NOT NULL
- created_at — TIMESTAMP — NOT NULL
user_customers
- id — BIGINT — Primary key — NOT NULL
- user_no — BIGINT — Foreign key → users.user_no — NOT NULL
- device_id — VARCHAR(255)
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
user_details
- user_no — BIGINT — Foreign key → users.user_no — NOT NULL
- name — VARCHAR(255)
- phone_number — VARCHAR(20) — NOT NULL
- email — VARCHAR(255)
- address — VARCHAR(1024)
- sex — user_sex_enum
- birthdate — DATE
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
user_devices
- device_no — BIGINT — Primary key — NOT NULL
- user_no — BIGINT — Foreign key → users.user_no — NOT NULL
- device_id — VARCHAR(255) — NOT NULL
- fcm_token — TEXT
- model — VARCHAR(255)
- os_type — VARCHAR(50)
- os_version — VARCHAR(50)
- created_at — TIMESTAMP — NOT NULL
- last_seen_at — TIMESTAMP — NOT NULL
user_merchants
- id — BIGINT — Primary key — NOT NULL
- user_no — BIGINT — Foreign key → users.user_no — NOT NULL
- business_name — VARCHAR(255)
- representative_name — VARCHAR(255)
- business_registration_number — VARCHAR(255)
- created_at — TIMESTAMPTZ — NOT NULL
- updated_at — TIMESTAMPTZ — NOT NULL
user_profiles
- user_no — BIGINT — Foreign key → users.user_no — NOT NULL
- nickname — VARCHAR(255)
- image_url — VARCHAR(2048)
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
user_terms_agreements
- user_no — BIGINT — Foreign key → users.user_no — NOT NULL
- terms_id — Foreign key → terms.id — NOT NULL
- agreed_at — TIMESTAMP — NOT NULL
users
- user_no — BIGINT — Primary key — NOT NULL
- login_type — ENUM — NOT NULL — GUEST, PASSWORD, SOCIAL, etc
- uuid — CHAR(36) — NOT NULL
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL