Plavor

Tables (10)

cart_items

  • id — BIGSERIAL — Primary key — NOT NULL
  • cart_id — BIGINT — Foreign key → carts.id — NOT NULL
  • product_id — BIGINT — Foreign key → products.id — NOT NULL
  • quantity — INTEGER — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

carts

  • id — BIGSERIAL — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

categories

  • id — BIGSERIAL — Primary key — NOT NULL
  • name — VARCHAR(100) — NOT NULL
  • slug — VARCHAR(120) — NOT NULL
  • display_order — INTEGER — NOT NULL
  • active — BOOLEAN — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

order_items

  • id — BIGSERIAL — Primary key — NOT NULL
  • order_id — BIGINT — Foreign key → orders.id — NOT NULL
  • product_id — BIGINT — Foreign key → products.id — NOT NULL
  • product_name — VARCHAR(200) — NOT NULL
  • unit_price — BIGINT — NOT NULL
  • quantity — INTEGER — NOT NULL
  • total_price — BIGINT — NOT NULL
  • created_at — TIMESTAMP — NOT NULL

orders

  • id — BIGSERIAL — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • order_number — VARCHAR(50) — NOT NULL
  • status — VARCHAR(20) — NOT NULL
  • total_amount — BIGINT — NOT NULL
  • receiver_name — VARCHAR(100) — NOT NULL
  • receiver_phone — VARCHAR(30) — NOT NULL
  • postal_code — VARCHAR(20) — NOT NULL
  • address — VARCHAR(255) — NOT NULL
  • address_detail — VARCHAR(255)
  • delivery_message — VARCHAR(255)
  • ordered_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

product_images

  • id — BIGSERIAL — Primary key — NOT NULL
  • product_id — BIGINT — Foreign key → products.id — NOT NULL
  • image_url — VARCHAR(500) — NOT NULL
  • alt_text — VARCHAR(255)
  • display_order — INTEGER — NOT NULL
  • thumbnail — BOOLEAN — NOT NULL
  • created_at — TIMESTAMP — NOT NULL

products

  • id — BIGSERIAL — Primary key — NOT NULL
  • category_id — BIGINT — Foreign key → categories.id — NOT NULL
  • name — VARCHAR(200) — NOT NULL
  • description — TEXT
  • price — BIGINT — NOT NULL
  • stock_quantity — INTEGER — NOT NULL
  • status — VARCHAR(20) — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

social_accounts

  • id — BIGSERIAL — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • provider — VARCHAR(20) — NOT NULL
  • provider_user_id — VARCHAR(100) — NOT NULL
  • provider_email — VARCHAR(255)
  • connected_at — TIMESTAMP — NOT NULL

user_credentials

  • id — BIGSERIAL — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • password_hash — VARCHAR(255) — NOT NULL
  • email_verified — BOOLEAN — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

users

  • id — BIGSERIAL — Primary key — NOT NULL
  • email — VARCHAR(255) — NOT NULL
  • name — VARCHAR(100) — NOT NULL
  • phone — VARCHAR(30)
  • role — VARCHAR(20) — NOT NULL
  • status — VARCHAR(20) — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL