Enum "orders_status_enum" {
  "created"
  "running"
  "done"
  "failure"
}

Enum "products_status_enum" {
  "Out of Stock"
  "In Stock"
}

Table "orders" {
  "id" int [pk, increment]
  "user_id" int [unique, not null]
  "status" orders_status_enum
  "created_at" varchar(255)
}

Table "order_items" {
  "order_id" int
  "product_id" int
  "quantity" int [default: 1]
}

Table "products" {
  "id" int [pk]
  "name" varchar(255)
  "merchant_id" int [not null]
  "price" int
  "status" products_status_enum
  "created_at" datetime [default: `now()`]

  Indexes {
    (merchant_id, status) [name: "product_status"]
    id [type: hash, unique, name: "products_index_1"]
  }
}

Table "users" {
  "id" int [pk]
  "full_name" varchar(255)
  "email" varchar(255) [unique]
  "gender" varchar(255)
  "date_of_birth" varchar(255)
  "created_at" varchar(255)
  "country_code" int
}

Table "merchants" {
  "id" int [pk]
  "merchant_name" varchar(255)
  "country_code" int
  "created_at" varchar(255)
  "admin_id" int
}

Table "countries" {
  "code" int [pk]
  "name" varchar(255)
  "continent_name" varchar(255)
}

Ref:"orders"."id" < "order_items"."order_id"

Ref:"products"."id" < "order_items"."product_id"

Ref:"countries"."code" < "users"."country_code"

Ref:"countries"."code" < "merchants"."country_code"

Ref:"merchants"."id" < "products"."merchant_id"

Ref:"users"."id" < "merchants"."admin_id"

