---
# System prepended metadata

title: Database Schema

---

# Database Schema
```plantuml

package bria_caffe_db {

    entity product{
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *name_produk : varchar
        *category : JSON <<FK>>
        *description : varchar
    }
    
    entity product_modifiers {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *name_product_modifiers : varchar
    }
    
    entity product_unit {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *name_product_unit : varchar
    }


    entity category_product {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *id
    
    }
    
    entity Master_category_product {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *name_category : varchar
    
    }
    
    entity price_unit {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *name_price_unit : varchar
    }
    
    entity prices {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *prices : desimal(12,2)
    }
    
    entity packages {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *name_package : varchar
        *product_id : uuid <<FK>>
        *prices_id : uuid <<FK>>
    }
    
       
    entity order_item {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *packages_id : uuid <<FK>>
        *quantity : number
        *order_modifiers_id : uuid <<FK>>
    }
    
    entity order {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *customer_name : varchar
        *order_code : varchar <<unique>>
        *order_item_id : id <<FK>>
        *table_id : id <<FK>>
    }
    
    entity order_modifiers {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *product_modifiers : uuid <<FK>>
    }
    
    entity billing_item {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *order_id : uuid <<FK>>
        *id_price_unit : uuid <<FK>>
    }
    
    entity billing {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *billing_item_id : uuid <<FK>>
    }
    
    entity charge_type {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *name_charge_type : varchar
    }
    
    entity payment_methods {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *name_payment_methods : varchar
    }
    
    entity payment_item {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *billing_id : uuid <<FK>>
        *charge_type_id : uuid <<FK>>
        *sub_amount : desimal(12,2)
        *payment_method : uuid <<FK>>
    }
    
    entity payment {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *payment_code : varchar <<unique>>
        *payment_item_id : uuid <<FK>>
        *amount : desimal(12,2)
    }
    
    entity users {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *name_user : varchar 
        *user_role_id : uuid <<FK>>
    }
    
    entity user_role {
        *id : uuid <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *name_user_role : varchar 
    }
    
    entity table {
        *id : int <<PK>>
        *created_at: timestamp 
        *updated_at: timestamp
        *deleted_at: timestamp
        ----
        *name_table : varchar
        *status_table : int
    }
    

    
    

    
    
product ||--o{ category_product
product ||--|| product_unit
order_modifiers ||--o{ product_modifiers
order_item ||--o{ order_modifiers
price_unit ||--|| billing_item
packages ||--o{ product
packages ||--|| prices
order_item ||--o{ packages
order ||--o{ order_item
billing_item ||--|{ order
billing ||--o{ billing_item
payment_item ||--|| charge_type
payment_item ||--|{ billing
payment_item ||--|| payment_methods 
payment ||--|{ payment_item
user_role ||--|| users
table ||--|{ order
    
}

 
```