new erd
Tables (12)
ACTIVITY_LOGS
- log_id — bigint
- user_id — bigint — NOT NULL
- action_type — varchar(255) — NOT NULL
- description — text — NOT NULL
- created_at — timestamp — NOT NULL
- ip_address — varchar(255) — NOT NULL
CART_ITEMS
- cart_item_id — bigint
- user_id — bigint — NOT NULL
- product_id — bigint — NOT NULL
- quantity — int — NOT NULL
- added_at — timestamp — NOT NULL
COUPONS
- coupon_id — bigint
- code — varchar(255) — NOT NULL
- type — varchar(255) — NOT NULL
- value — decimal(10,2) — NOT NULL
- total_quantity — int — NOT NULL
- used_quantity — int — NOT NULL
- per_user_limit — int — NOT NULL
- valid_from — timestamp — NOT NULL
- valid_until — timestamp — NOT NULL
- is_active — boolean — NOT NULL
- created_at — timestamp — NOT NULL
- updated_at — timestamp — NOT NULL
COUPON_HISTORY
- history_id — bigint
- user_id — bigint — NOT NULL
- coupon_id — bigint — NOT NULL
- action — varchar(255) — NOT NULL
- action_date — timestamp — NOT NULL
ORDERS
- order_id — bigint
- user_id — bigint — NOT NULL
- total_amount — decimal(10,2) — NOT NULL
- status — varchar(255) — NOT NULL
- order_date — timestamp — NOT NULL
- coupon_id — bigint
- shipping_address — text — NOT NULL
ORDER_ITEMS
- order_item_id — bigint
- order_id — bigint — NOT NULL
- product_id — bigint — NOT NULL
- quantity — int — NOT NULL
- unit_price — decimal(10,2) — NOT NULL
- subtotal — decimal(10,2) — NOT NULL
PAYMENTS
- payment_id — bigint
- order_id — bigint — NOT NULL
- amount — decimal(10,2) — NOT NULL
- payment_method — varchar(255) — NOT NULL
- status — varchar(255) — NOT NULL
- payment_date — timestamp — NOT NULL
PRODUCTS
- product_id — bigint
- name — varchar(255) — NOT NULL
- description — text
- price — decimal(10,2) — NOT NULL
- category — varchar(255)
- created_at — timestamp — NOT NULL
- updated_at — timestamp — NOT NULL
- is_active — boolean — NOT NULL
PRODUCT_ANALYTICS
- analytics_id — bigint
- product_id — bigint — NOT NULL
- view_count — int — NOT NULL
- purchase_count — int — NOT NULL
- conversion_rate — decimal(5,2) — NOT NULL
- recorded_at — timestamp — NOT NULL
PRODUCT_INVENTORY
- inventory_id — bigint
- product_id — bigint — NOT NULL
- quantity — int — NOT NULL
- last_updated — timestamp — NOT NULL
USERS
- user_id — bigint
- email — varchar(255) — NOT NULL
- password — varchar(255) — NOT NULL
- name — varchar(255) — NOT NULL
- phone — varchar(255)
- created_at — timestamp — NOT NULL
- updated_at — timestamp — NOT NULL
- is_active — boolean — NOT NULL
USER_COUPONS
- user_coupon_id — bigint
- user_id — bigint — NOT NULL
- coupon_id — bigint — NOT NULL
- is_used — boolean — NOT NULL
- used_at — timestamp
- issued_at — timestamp — NOT NULL