e-commerce-sample
Tables (46)
ad_campaigns
- id — bigint — Primary key — NOT NULL
- campaign_code — text — NOT NULL
- name — text — NOT NULL
- ad_channel — text — NOT NULL
- objective — text — NOT NULL
- promotion_id — bigint — Foreign key → promotions.id
- exhibition_id — bigint — Foreign key → exhibitions.id
- start_at — timestamptz — NOT NULL
- end_at — timestamptz
- daily_budget — integer
- total_budget — bigint
- status — text — NOT NULL
- agency_name — text
- owner_department_id — bigint — Foreign key → departments.id — NOT NULL
- manager_employee_id — bigint — Foreign key → employees.id
ad_creative_products
- creative_id — bigint — Foreign key → ad_creatives.id — NOT NULL
- product_id — bigint — Foreign key → products.id — NOT NULL
ad_creatives
- id — bigint — Primary key — NOT NULL
- campaign_id — bigint — Foreign key → ad_campaigns.id — NOT NULL
- creative_type — text — NOT NULL
- headline — text
- body_text — text
- displayed_price — integer
- displayed_discount_rate — numeric(5,2)
- landing_product_id — bigint — Foreign key → products.id
- landing_exhibition_id — bigint — Foreign key → exhibitions.id
- landing_url — text
- status — text — NOT NULL
- updated_at — timestamptz — NOT NULL
brands
- id — bigint — Primary key — NOT NULL
- brand_code — text — NOT NULL
- name — text — NOT NULL
- name_en — text
- supplier_id — bigint — Foreign key → suppliers.id
- partner_type — text — NOT NULL
- commission_rate — numeric(5,4)
- partner_manager_id — bigint — Foreign key → employees.id
- is_active — boolean — NOT NULL
bundle_components
- id — bigint — Primary key — NOT NULL
- bundle_product_id — bigint — Foreign key → products.id — NOT NULL
- component_product_id — bigint — Foreign key → products.id — NOT NULL
- component_sku_id — bigint — Foreign key → product_skus.id
- quantity — integer — NOT NULL
- sort_order — integer — NOT NULL
categories
- id — bigint — Primary key — NOT NULL
- parent_id — bigint — Foreign key → categories.id
- code — text — NOT NULL
- name — text — NOT NULL
- depth — smallint — NOT NULL
- sort_order — integer — NOT NULL
change_request_items
- id — bigint — Primary key — NOT NULL
- change_request_id — bigint — Foreign key → change_requests.id — NOT NULL
- product_id — bigint — Foreign key → products.id — NOT NULL
- sku_id — bigint — Foreign key → product_skus.id
- current_list_price — integer
- current_sale_price — integer
- new_list_price — integer
- new_sale_price — integer
- current_unit_cost — integer
- new_unit_cost — integer
- successor_product_id — bigint — Foreign key → products.id
- composition_note — text
- note — text
change_requests
- id — bigint — Primary key — NOT NULL
- request_code — text — NOT NULL
- request_type — text — NOT NULL
- title — text — NOT NULL
- reason_type — text — NOT NULL
- description — text
- supplier_id — bigint — Foreign key → suppliers.id
- requested_by — bigint — Foreign key → employees.id — NOT NULL
- status — text — NOT NULL
- effective_at — timestamptz — NOT NULL
- created_at — timestamptz — NOT NULL
channel_listings
- id — bigint — Primary key — NOT NULL
- channel_id — bigint — Foreign key → sales_channels.id — NOT NULL
- product_id — bigint — Foreign key → products.id — NOT NULL
- external_product_id — text
- listed_price — integer — NOT NULL
- sync_mode — text — NOT NULL
- status — text — NOT NULL
- last_synced_at — timestamptz
claims
- id — bigint — Primary key — NOT NULL
- claim_number — text — NOT NULL
- order_id — bigint — Foreign key → orders.id — NOT NULL
- order_item_id — bigint — Foreign key → order_items.id — NOT NULL
- claim_type — text — NOT NULL
- reason_code — text — NOT NULL
- reason_detail — text
- status — text — NOT NULL
- exchange_sku_id — bigint — Foreign key → product_skus.id
- refund_amount — integer
- return_shipping_fee — integer
- fault_party — text
- requested_at — timestamptz — NOT NULL
- completed_at — timestamptz
- handled_by — bigint — Foreign key → employees.id
coupon_targets
- id — bigint — Primary key — NOT NULL
- coupon_id — bigint — Foreign key → coupons.id — NOT NULL
- product_id — bigint — Foreign key → products.id
- category_id — bigint — Foreign key → categories.id
- brand_id — bigint — Foreign key → brands.id
- is_excluded — boolean — NOT NULL
coupons
- id — bigint — Primary key — NOT NULL
- coupon_code — text — NOT NULL
- name — text — NOT NULL
- coupon_type — text — NOT NULL
- discount_type — text — NOT NULL
- discount_value — numeric(12,2) — NOT NULL
- max_discount_amount — integer
- min_order_amount — integer — NOT NULL
- issue_method — text — NOT NULL
- valid_from — timestamptz — NOT NULL
- valid_to — timestamptz — NOT NULL
- total_issue_limit — integer
- per_customer_limit — integer — NOT NULL
- stackable_with_promotion — boolean — NOT NULL
- brand_funding_rate — numeric(5,4) — NOT NULL
- promotion_id — bigint — Foreign key → promotions.id
- status — text — NOT NULL
- owner_department_id — bigint — Foreign key → departments.id — NOT NULL
- manager_employee_id — bigint — Foreign key → employees.id
cs_inquiries
- id — bigint — Primary key — NOT NULL
- inquiry_number — text — NOT NULL
- customer_id — bigint — Foreign key → customers.id
- order_id — bigint — Foreign key → orders.id
- order_item_id — bigint — Foreign key → order_items.id
- product_id — bigint — Foreign key → products.id
- claim_id — bigint — Foreign key → claims.id
- inquiry_channel — text — NOT NULL
- category — text — NOT NULL
- title — text — NOT NULL
- body — text — NOT NULL
- status — text — NOT NULL
- priority — text — NOT NULL
- assigned_employee_id — bigint — Foreign key → employees.id
- answer_body — text
- used_document_id — bigint — Foreign key → documents.id
- created_at — timestamptz — NOT NULL
- answered_at — timestamptz
customer_coupons
- id — bigint — Primary key — NOT NULL
- coupon_id — bigint — Foreign key → coupons.id — NOT NULL
- customer_id — bigint — Foreign key → customers.id — NOT NULL
- issued_at — timestamptz — NOT NULL
- expires_at — timestamptz — NOT NULL
- status — text — NOT NULL
- used_at — timestamptz
- order_id — bigint — Foreign key → orders.id
customers
- id — bigint — Primary key — NOT NULL
- customer_code — text — NOT NULL
- name — text — NOT NULL
- email — text
- phone — text
- gender — text
- birth_year — smallint
- grade — text — NOT NULL
- marketing_opt_in_push — boolean — NOT NULL
- marketing_opt_in_sms — boolean — NOT NULL
- marketing_opt_in_email — boolean — NOT NULL
- status — text — NOT NULL
- joined_at — timestamptz — NOT NULL
department_responsibilities
- id — bigint — Primary key — NOT NULL
- department_id — bigint — Foreign key → departments.id — NOT NULL
- entity_type — text — NOT NULL
- trigger_event — text — NOT NULL
- action_description — text — NOT NULL
- sla_hours — integer
departments
- id — bigint — Primary key — NOT NULL
- code — text — NOT NULL
- name — text — NOT NULL
- description — text
document_links
- id — bigint — Primary key — NOT NULL
- document_id — bigint — Foreign key → documents.id — NOT NULL
- product_id — bigint — Foreign key → products.id
- brand_id — bigint — Foreign key → brands.id
- category_id — bigint — Foreign key → categories.id
- promotion_id — bigint — Foreign key → promotions.id
- coupon_id — bigint — Foreign key → coupons.id
- exhibition_id — bigint — Foreign key → exhibitions.id
- ad_campaign_id — bigint — Foreign key → ad_campaigns.id
documents
- id — bigint — Primary key — NOT NULL
- doc_code — text — NOT NULL
- title — text — NOT NULL
- doc_category — text — NOT NULL
- audience — text — NOT NULL
- owner_department_id — bigint — Foreign key → departments.id
- file_format — text — NOT NULL
- storage_path — text — NOT NULL
- version — text — NOT NULL
- status — text — NOT NULL
- effective_from — date
- effective_to — date
- summary — text
employees
- id — bigint — Primary key — NOT NULL
- employee_code — text — NOT NULL
- name — text — NOT NULL
- department_id — bigint — Foreign key → departments.id — NOT NULL
- job_title — text
- email — text
- is_active — boolean — NOT NULL
exhibition_products
- exhibition_id — bigint — Foreign key → exhibitions.id — NOT NULL
- product_id — bigint — Foreign key → products.id — NOT NULL
- display_order — integer — NOT NULL
- display_price — integer
- badge_text — text
exhibitions
- id — bigint — Primary key — NOT NULL
- exhibition_code — text — NOT NULL
- title — text — NOT NULL
- exhibition_type — text — NOT NULL
- promotion_id — bigint — Foreign key → promotions.id
- banner_text — text
- start_at — timestamptz — NOT NULL
- end_at — timestamptz — NOT NULL
- status — text — NOT NULL
- owner_department_id — bigint — Foreign key → departments.id — NOT NULL
- manager_employee_id — bigint — Foreign key → employees.id
inventory
- sku_id — bigint — Foreign key → product_skus.id — NOT NULL
- warehouse_id — bigint — Foreign key → warehouses.id — NOT NULL
- on_hand_qty — integer — NOT NULL
- reserved_qty — integer — NOT NULL
- safety_stock_qty — integer — NOT NULL
- updated_at — timestamptz — NOT NULL
inventory_transactions
- id — bigint — Primary key — NOT NULL
- sku_id — bigint — Foreign key → product_skus.id — NOT NULL
- warehouse_id — bigint — Foreign key → warehouses.id — NOT NULL
- txn_type — text — NOT NULL
- quantity — integer — NOT NULL
- reference_type — text
- reference_id — bigint
- occurred_at — timestamptz — NOT NULL
- memo — text
order_item_discounts
- id — bigint — Primary key — NOT NULL
- order_item_id — bigint — Foreign key → order_items.id — NOT NULL
- discount_source — text — NOT NULL
- promotion_id — bigint — Foreign key → promotions.id
- coupon_id — bigint — Foreign key → coupons.id
- amount — integer — NOT NULL
order_items
- id — bigint — Primary key — NOT NULL
- order_id — bigint — Foreign key → orders.id — NOT NULL
- parent_order_item_id — bigint — Foreign key → order_items.id
- product_id — bigint — Foreign key → products.id — NOT NULL
- sku_id — bigint — Foreign key → product_skus.id
- quantity — integer — NOT NULL
- unit_list_price — integer — NOT NULL
- unit_sale_price — integer — NOT NULL
- unit_paid_price — integer — NOT NULL
- status — text — NOT NULL
- is_preorder — boolean — NOT NULL
- expected_ship_date — date
- shipment_id — bigint — Foreign key → shipments.id
orders
- id — bigint — Primary key — NOT NULL
- order_number — text — NOT NULL
- customer_id — bigint — Foreign key → customers.id — NOT NULL
- channel_id — bigint — Foreign key → sales_channels.id — NOT NULL
- ordered_at — timestamptz — NOT NULL
- status — text — NOT NULL
- total_list_amount — integer — NOT NULL
- product_discount_amount — integer — NOT NULL
- coupon_discount_amount — integer — NOT NULL
- point_used — integer — NOT NULL
- shipping_fee — integer — NOT NULL
- total_paid_amount — integer — NOT NULL
- recipient_name — text — NOT NULL
- recipient_phone — text
- zip_code — text
- shipping_address — text — NOT NULL
payments
- id — bigint — Primary key — NOT NULL
- order_id — bigint — Foreign key → orders.id — NOT NULL
- method — text — NOT NULL
- amount — integer — NOT NULL
- status — text — NOT NULL
- approved_at — timestamptz
- pg_transaction_id — text
price_policies
- id — bigint — Primary key — NOT NULL
- policy_code — text — NOT NULL
- name — text — NOT NULL
- policy_type — text — NOT NULL
- scope_type — text — NOT NULL
- category_id — bigint — Foreign key → categories.id
- brand_id — bigint — Foreign key → brands.id
- product_id — bigint — Foreign key → products.id
- channel_id — bigint — Foreign key → sales_channels.id
- parameters — jsonb — NOT NULL
- effective_from — date — NOT NULL
- effective_to — date
- owner_department_id — bigint — Foreign key → departments.id
- source_document_id — bigint — Foreign key → documents.id
- is_active — boolean — NOT NULL
product_cost_history
- id — bigint — Primary key — NOT NULL
- product_id — bigint — Foreign key → products.id — NOT NULL
- supplier_id — bigint — Foreign key → suppliers.id — NOT NULL
- unit_cost — integer — NOT NULL
- valid_from — date — NOT NULL
- valid_to — date
- reason — text
- change_request_id — bigint — Foreign key → change_requests.id
product_pages
- id — bigint — Primary key — NOT NULL
- product_id — bigint — Foreign key → products.id — NOT NULL
- page_type — text — NOT NULL
- title — text
- body_text — text — NOT NULL
- mentioned_price — integer
- status — text — NOT NULL
- content_owner_id — bigint — Foreign key → employees.id
- published_at — timestamptz
- updated_at — timestamptz — NOT NULL
product_price_history
- id — bigint — Primary key — NOT NULL
- product_id — bigint — Foreign key → products.id — NOT NULL
- list_price — integer — NOT NULL
- sale_price — integer — NOT NULL
- valid_from — timestamptz — NOT NULL
- valid_to — timestamptz
- reason — text
- change_request_id — bigint — Foreign key → change_requests.id
product_qna
- id — bigint — Primary key — NOT NULL
- product_id — bigint — Foreign key → products.id — NOT NULL
- customer_id — bigint — Foreign key → customers.id
- question — text — NOT NULL
- answer — text
- answered_by_type — text
- answered_by — bigint — Foreign key → employees.id
- is_secret — boolean — NOT NULL
- created_at — timestamptz — NOT NULL
- answered_at — timestamptz
product_skus
- id — bigint — Primary key — NOT NULL
- product_id — bigint — Foreign key → products.id — NOT NULL
- sku_code — text — NOT NULL
- color — text
- size — text
- additional_price — integer — NOT NULL
- barcode — text
- status — text — NOT NULL
- discontinued_at — timestamptz
products
- id — bigint — Primary key — NOT NULL
- product_code — text — NOT NULL
- name — text — NOT NULL
- brand_id — bigint — Foreign key → brands.id — NOT NULL
- supplier_id — bigint — Foreign key → suppliers.id
- category_id — bigint — Foreign key → categories.id — NOT NULL
- product_type — text — NOT NULL
- gender — text
- season — text
- material — text
- list_price — integer — NOT NULL — 정가. 할인율 표시의 기준가
- sale_price — integer — NOT NULL — 상시 판매가. 프로모션/쿠폰은 이 가격 위에 적용
- status — text — NOT NULL
- launched_at — timestamptz
- discontinued_at — timestamptz
- successor_product_id — bigint — Foreign key → products.id
- md_employee_id — bigint — Foreign key → employees.id
- attributes — jsonb — NOT NULL
- created_at — timestamptz — NOT NULL
- updated_at — timestamptz — NOT NULL
promotion_targets
- id — bigint — Primary key — NOT NULL
- promotion_id — bigint — Foreign key → promotions.id — NOT NULL
- product_id — bigint — Foreign key → products.id
- sku_id — bigint — Foreign key → product_skus.id
- category_id — bigint — Foreign key → categories.id
- brand_id — bigint — Foreign key → brands.id
- is_excluded — boolean — NOT NULL
- promo_price — integer
promotions
- id — bigint — Primary key — NOT NULL
- promotion_code — text — NOT NULL
- name — text — NOT NULL
- promotion_type — text — NOT NULL
- discount_type — text — NOT NULL
- discount_value — numeric(12,2)
- max_discount_amount — integer
- gift_product_id — bigint — Foreign key → products.id
- start_at — timestamptz — NOT NULL
- end_at — timestamptz — NOT NULL
- status — text — NOT NULL
- price_locked — boolean — NOT NULL
- lowest_price_guaranteed — boolean — NOT NULL
- stackable_with_coupon — boolean — NOT NULL
- platform_funding_rate — numeric(5,4) — NOT NULL
- budget_amount — bigint
- partner_brand_id — bigint — Foreign key → brands.id
- owner_department_id — bigint — Foreign key → departments.id — NOT NULL
- manager_employee_id — bigint — Foreign key → employees.id
- created_at — timestamptz — NOT NULL
purchase_order_items
- id — bigint — Primary key — NOT NULL
- purchase_order_id — bigint — Foreign key → purchase_orders.id — NOT NULL
- sku_id — bigint — Foreign key → product_skus.id — NOT NULL
- quantity_ordered — integer — NOT NULL
- quantity_received — integer — NOT NULL
- unit_cost — integer — NOT NULL
purchase_orders
- id — bigint — Primary key — NOT NULL
- po_number — text — NOT NULL
- supplier_id — bigint — Foreign key → suppliers.id — NOT NULL
- warehouse_id — bigint — Foreign key → warehouses.id — NOT NULL
- status — text — NOT NULL
- ordered_at — timestamptz
- expected_at — timestamptz
- created_by — bigint — Foreign key → employees.id
restock_alerts
- id — bigint — Primary key — NOT NULL
- customer_id — bigint — Foreign key → customers.id — NOT NULL
- sku_id — bigint — Foreign key → product_skus.id — NOT NULL
- requested_at — timestamptz — NOT NULL
- status — text — NOT NULL
- notified_at — timestamptz
reviews
- id — bigint — Primary key — NOT NULL
- order_item_id — bigint — Foreign key → order_items.id
- customer_id — bigint — Foreign key → customers.id — NOT NULL
- product_id — bigint — Foreign key → products.id — NOT NULL
- sku_id — bigint — Foreign key → product_skus.id
- rating — smallint — NOT NULL
- size_feedback — text
- body — text
- has_photo — boolean — NOT NULL
- created_at — timestamptz — NOT NULL
sales_channels
- id — bigint — Primary key — NOT NULL
- code — text — NOT NULL
- name — text — NOT NULL
- channel_type — text — NOT NULL
- is_active — boolean — NOT NULL
shipments
- id — bigint — Primary key — NOT NULL
- order_id — bigint — Foreign key → orders.id — NOT NULL
- warehouse_id — bigint — Foreign key → warehouses.id
- carrier — text
- tracking_number — text
- status — text — NOT NULL
- shipped_at — timestamptz
- delivered_at — timestamptz
suppliers
- id — bigint — Primary key — NOT NULL
- supplier_code — text — NOT NULL
- company_name — text — NOT NULL
- business_number — text
- contact_name — text
- contact_email — text
- contact_phone — text
- country — text — NOT NULL
- is_active — boolean — NOT NULL
warehouses
- id — bigint — Primary key — NOT NULL
- code — text — NOT NULL
- name — text — NOT NULL
- warehouse_type — text — NOT NULL
- address — text
wishlists
- customer_id — bigint — Foreign key → customers.id — NOT NULL
- product_id — bigint — Foreign key → products.id — NOT NULL
- created_at — timestamptz — NOT NULL