update database
This commit is contained in:
415
database.md
Normal file
415
database.md
Normal file
@@ -0,0 +1,415 @@
|
||||
classDiagram
|
||||
direction BT
|
||||
class audit_logs {
|
||||
varchar(50) user_id
|
||||
varchar(100) action
|
||||
varchar(50) entity_type
|
||||
varchar(50) entity_id
|
||||
jsonb old_value
|
||||
jsonb new_value
|
||||
inet ip_address
|
||||
text user_agent
|
||||
timestamp with time zone timestamp
|
||||
bigint log_id
|
||||
}
|
||||
class cart_items {
|
||||
varchar(50) cart_id
|
||||
varchar(50) product_id
|
||||
numeric(12,2) quantity
|
||||
numeric(12,2) unit_price
|
||||
numeric(12,2) subtotal
|
||||
timestamp with time zone added_at
|
||||
varchar(50) cart_item_id
|
||||
}
|
||||
class carts {
|
||||
varchar(50) user_id
|
||||
numeric(12,2) total_amount
|
||||
boolean is_synced
|
||||
timestamp with time zone last_modified
|
||||
timestamp with time zone created_at
|
||||
varchar(50) cart_id
|
||||
}
|
||||
class chat_messages {
|
||||
varchar(50) chat_room_id
|
||||
varchar(50) sender_id
|
||||
content_type content_type
|
||||
text content
|
||||
varchar(500) attachment_url
|
||||
varchar(50) product_reference
|
||||
boolean is_read
|
||||
boolean is_edited
|
||||
boolean is_deleted
|
||||
jsonb read_by
|
||||
timestamp with time zone timestamp
|
||||
timestamp with time zone edited_at
|
||||
varchar(50) message_id
|
||||
}
|
||||
class chat_rooms {
|
||||
room_type room_type
|
||||
varchar(50) related_quote_id
|
||||
varchar(50) related_order_id
|
||||
jsonb participants
|
||||
varchar(100) room_name
|
||||
boolean is_active
|
||||
timestamp with time zone last_activity
|
||||
timestamp with time zone created_at
|
||||
varchar(50) created_by
|
||||
varchar(50) chat_room_id
|
||||
}
|
||||
class design_requests {
|
||||
varchar(50) user_id
|
||||
varchar(200) project_name
|
||||
project_type project_type
|
||||
numeric(10,2) area
|
||||
varchar(100) style
|
||||
numeric(12,2) budget
|
||||
text current_situation
|
||||
text requirements
|
||||
text notes
|
||||
jsonb attachments
|
||||
design_status status
|
||||
varchar(100) assigned_designer
|
||||
varchar(500) final_design_link
|
||||
text feedback
|
||||
integer rating
|
||||
date estimated_completion
|
||||
timestamp with time zone created_at
|
||||
timestamp with time zone completed_at
|
||||
timestamp with time zone updated_at
|
||||
varchar(50) request_id
|
||||
}
|
||||
class gift_catalog {
|
||||
varchar(200) name
|
||||
text description
|
||||
varchar(500) image_url
|
||||
gift_category category
|
||||
integer points_cost
|
||||
numeric(12,2) cash_value
|
||||
integer quantity_available
|
||||
integer quantity_redeemed
|
||||
text terms_conditions
|
||||
boolean is_active
|
||||
date valid_from
|
||||
date valid_until
|
||||
timestamp with time zone created_at
|
||||
timestamp with time zone updated_at
|
||||
varchar(50) catalog_id
|
||||
}
|
||||
class invoices {
|
||||
varchar(50) invoice_number
|
||||
varchar(50) user_id
|
||||
varchar(50) order_id
|
||||
invoice_type invoice_type
|
||||
date issue_date
|
||||
date due_date
|
||||
varchar(3) currency
|
||||
numeric(12,2) subtotal_amount
|
||||
numeric(12,2) tax_amount
|
||||
numeric(12,2) discount_amount
|
||||
numeric(12,2) shipping_amount
|
||||
numeric(12,2) total_amount
|
||||
numeric(12,2) amount_paid
|
||||
numeric(12,2) amount_remaining
|
||||
invoice_status status
|
||||
text payment_terms
|
||||
text notes
|
||||
varchar(50) erpnext_invoice
|
||||
timestamp with time zone created_at
|
||||
timestamp with time zone updated_at
|
||||
timestamp with time zone last_reminder_sent
|
||||
varchar(50) invoice_id
|
||||
}
|
||||
class loyalty_point_entries {
|
||||
varchar(50) user_id
|
||||
integer points
|
||||
entry_type entry_type
|
||||
entry_source source
|
||||
text description
|
||||
varchar(50) reference_id
|
||||
varchar(50) reference_type
|
||||
jsonb complaint
|
||||
complaint_status complaint_status
|
||||
integer balance_after
|
||||
date expiry_date
|
||||
timestamp with time zone timestamp
|
||||
varchar(50) erpnext_entry_id
|
||||
varchar(50) entry_id
|
||||
}
|
||||
class notifications {
|
||||
varchar(50) user_id
|
||||
varchar(50) type
|
||||
varchar(200) title
|
||||
text message
|
||||
jsonb data
|
||||
boolean is_read
|
||||
boolean is_pushed
|
||||
timestamp with time zone created_at
|
||||
timestamp with time zone read_at
|
||||
varchar(50) notification_id
|
||||
}
|
||||
class order_items {
|
||||
varchar(50) order_id
|
||||
varchar(50) product_id
|
||||
numeric(12,2) quantity
|
||||
numeric(12,2) unit_price
|
||||
numeric(5,2) discount_percent
|
||||
numeric(12,2) subtotal
|
||||
text notes
|
||||
varchar(50) order_item_id
|
||||
}
|
||||
class orders {
|
||||
varchar(50) order_number
|
||||
varchar(50) user_id
|
||||
order_status status
|
||||
numeric(12,2) total_amount
|
||||
numeric(12,2) discount_amount
|
||||
numeric(12,2) tax_amount
|
||||
numeric(12,2) shipping_fee
|
||||
numeric(12,2) final_amount
|
||||
jsonb shipping_address
|
||||
jsonb billing_address
|
||||
date expected_delivery_date
|
||||
date actual_delivery_date
|
||||
text notes
|
||||
text cancellation_reason
|
||||
varchar(50) erpnext_sales_order
|
||||
timestamp with time zone created_at
|
||||
timestamp with time zone updated_at
|
||||
varchar(50) order_id
|
||||
}
|
||||
class payment_lines {
|
||||
varchar(50) invoice_id
|
||||
varchar(50) payment_number
|
||||
date payment_date
|
||||
numeric(12,2) amount
|
||||
payment_method payment_method
|
||||
varchar(100) bank_name
|
||||
varchar(50) bank_account
|
||||
varchar(100) reference_number
|
||||
text notes
|
||||
payment_status status
|
||||
varchar(500) receipt_url
|
||||
varchar(50) erpnext_payment_entry
|
||||
timestamp with time zone created_at
|
||||
timestamp with time zone processed_at
|
||||
varchar(50) payment_line_id
|
||||
}
|
||||
class payment_reminders {
|
||||
varchar(50) invoice_id
|
||||
varchar(50) user_id
|
||||
reminder_type reminder_type
|
||||
varchar(200) subject
|
||||
text message
|
||||
boolean is_read
|
||||
boolean is_sent
|
||||
timestamp with time zone scheduled_at
|
||||
timestamp with time zone sent_at
|
||||
timestamp with time zone read_at
|
||||
varchar(50) reminder_id
|
||||
}
|
||||
class points_records {
|
||||
varchar(50) user_id
|
||||
varchar(100) invoice_number
|
||||
varchar(200) store_name
|
||||
date transaction_date
|
||||
numeric(12,2) invoice_amount
|
||||
text notes
|
||||
jsonb attachments
|
||||
points_status status
|
||||
text reject_reason
|
||||
integer points_earned
|
||||
timestamp with time zone submitted_at
|
||||
timestamp with time zone processed_at
|
||||
varchar(50) processed_by
|
||||
varchar(50) record_id
|
||||
}
|
||||
class products {
|
||||
varchar(200) name
|
||||
text description
|
||||
numeric(12,2) base_price
|
||||
jsonb images
|
||||
jsonb image_captions
|
||||
varchar(500) link_360
|
||||
jsonb specifications
|
||||
varchar(100) category
|
||||
varchar(50) brand
|
||||
varchar(20) unit
|
||||
boolean is_active
|
||||
boolean is_featured
|
||||
varchar(50) erpnext_item_code
|
||||
timestamp with time zone created_at
|
||||
timestamp with time zone updated_at
|
||||
varchar(50) product_id
|
||||
}
|
||||
class project_submissions {
|
||||
varchar(50) user_id
|
||||
varchar(200) project_name
|
||||
text project_address
|
||||
numeric(12,2) project_value
|
||||
project_type project_type
|
||||
jsonb before_photos
|
||||
jsonb after_photos
|
||||
jsonb invoices
|
||||
submission_status status
|
||||
text review_notes
|
||||
text rejection_reason
|
||||
integer points_earned
|
||||
timestamp with time zone submitted_at
|
||||
timestamp with time zone reviewed_at
|
||||
varchar(50) reviewed_by
|
||||
varchar(50) submission_id
|
||||
}
|
||||
class quote_items {
|
||||
varchar(50) quote_id
|
||||
varchar(50) product_id
|
||||
numeric(12,2) quantity
|
||||
numeric(12,2) original_price
|
||||
numeric(12,2) negotiated_price
|
||||
numeric(5,2) discount_percent
|
||||
numeric(12,2) subtotal
|
||||
text notes
|
||||
varchar(50) quote_item_id
|
||||
}
|
||||
class quotes {
|
||||
varchar(50) quote_number
|
||||
varchar(50) user_id
|
||||
quote_status status
|
||||
numeric(12,2) total_amount
|
||||
numeric(12,2) discount_amount
|
||||
numeric(12,2) final_amount
|
||||
varchar(200) project_name
|
||||
jsonb delivery_address
|
||||
text payment_terms
|
||||
text notes
|
||||
date valid_until
|
||||
varchar(50) converted_order_id
|
||||
varchar(50) erpnext_quotation
|
||||
timestamp with time zone created_at
|
||||
timestamp with time zone updated_at
|
||||
varchar(50) quote_id
|
||||
}
|
||||
class redeemed_gifts {
|
||||
varchar(50) user_id
|
||||
varchar(50) catalog_id
|
||||
varchar(200) name
|
||||
text description
|
||||
varchar(50) voucher_code
|
||||
varchar(500) qr_code_image
|
||||
gift_category gift_type
|
||||
integer points_cost
|
||||
numeric(12,2) cash_value
|
||||
date expiry_date
|
||||
gift_status status
|
||||
timestamp with time zone redeemed_at
|
||||
timestamp with time zone used_at
|
||||
varchar(200) used_location
|
||||
varchar(100) used_reference
|
||||
varchar(50) gift_id
|
||||
}
|
||||
class showroom_products {
|
||||
numeric(10,2) quantity_used
|
||||
varchar(50) showroom_id
|
||||
varchar(50) product_id
|
||||
}
|
||||
class showrooms {
|
||||
varchar(200) title
|
||||
text description
|
||||
varchar(500) cover_image
|
||||
varchar(500) link_360
|
||||
numeric(10,2) area
|
||||
varchar(100) style
|
||||
varchar(200) location
|
||||
jsonb gallery_images
|
||||
integer view_count
|
||||
boolean is_featured
|
||||
boolean is_active
|
||||
timestamp with time zone published_at
|
||||
varchar(50) created_by
|
||||
varchar(50) showroom_id
|
||||
}
|
||||
class stock_levels {
|
||||
numeric(12,2) available_qty
|
||||
numeric(12,2) reserved_qty
|
||||
numeric(12,2) ordered_qty
|
||||
varchar(50) warehouse_code
|
||||
timestamp with time zone last_updated
|
||||
varchar(50) product_id
|
||||
}
|
||||
class system_settings {
|
||||
jsonb setting_value
|
||||
text description
|
||||
boolean is_public
|
||||
timestamp with time zone updated_at
|
||||
varchar(50) updated_by
|
||||
varchar(100) setting_key
|
||||
}
|
||||
class user_sessions {
|
||||
varchar(50) user_id
|
||||
varchar(100) device_id
|
||||
varchar(50) device_type
|
||||
varchar(100) device_name
|
||||
inet ip_address
|
||||
text user_agent
|
||||
varchar(500) refresh_token
|
||||
timestamp with time zone expires_at
|
||||
timestamp with time zone created_at
|
||||
timestamp with time zone last_activity
|
||||
varchar(100) session_id
|
||||
}
|
||||
class users {
|
||||
varchar(20) phone_number
|
||||
varchar(255) password_hash
|
||||
varchar(100) full_name
|
||||
varchar(100) email
|
||||
user_role role
|
||||
user_status status
|
||||
loyalty_tier loyalty_tier
|
||||
integer total_points
|
||||
jsonb company_info
|
||||
varchar(20) cccd
|
||||
jsonb attachments
|
||||
text address
|
||||
varchar(500) avatar_url
|
||||
varchar(20) referral_code
|
||||
varchar(50) referred_by
|
||||
varchar(50) erpnext_customer_id
|
||||
timestamp with time zone created_at
|
||||
timestamp with time zone updated_at
|
||||
timestamp with time zone last_login_at
|
||||
varchar(50) user_id
|
||||
}
|
||||
|
||||
cart_items --> carts : cart_id
|
||||
cart_items --> products : product_id
|
||||
carts --> users : user_id
|
||||
chat_messages --> chat_rooms : chat_room_id
|
||||
chat_messages --> products : product_reference:product_id
|
||||
chat_messages --> users : sender_id:user_id
|
||||
chat_rooms --> orders : related_order_id:order_id
|
||||
chat_rooms --> quotes : related_quote_id:quote_id
|
||||
chat_rooms --> users : created_by:user_id
|
||||
design_requests --> users : user_id
|
||||
invoices --> orders : order_id
|
||||
invoices --> users : user_id
|
||||
loyalty_point_entries --> users : user_id
|
||||
notifications --> users : user_id
|
||||
order_items --> orders : order_id
|
||||
order_items --> products : product_id
|
||||
orders --> users : user_id
|
||||
payment_lines --> invoices : invoice_id
|
||||
payment_reminders --> invoices : invoice_id
|
||||
payment_reminders --> users : user_id
|
||||
points_records --> users : user_id
|
||||
project_submissions --> users : user_id
|
||||
quote_items --> products : product_id
|
||||
quote_items --> quotes : quote_id
|
||||
quotes --> orders : converted_order_id:order_id
|
||||
quotes --> users : user_id
|
||||
redeemed_gifts --> gift_catalog : catalog_id
|
||||
redeemed_gifts --> users : user_id
|
||||
showroom_products --> products : product_id
|
||||
showroom_products --> showrooms : showroom_id
|
||||
showrooms --> users : created_by:user_id
|
||||
stock_levels --> products : product_id
|
||||
user_sessions --> users : user_id
|
||||
users --> users : referred_by:user_id
|
||||
Reference in New Issue
Block a user