Skip to main content

Data Model

Purpose

This page documents the actual high-level Maqsafy data model from the exported MySQL metadata. It uses table names, column counts, estimated row counts, foreign keys, and indexes to describe the current database structure.

Model Summary

MetricCount
Tables189
Columns2112
Foreign key links197
Index entries633

Domain-Based Table Inventory

Credentials & NFC

TableEstimated RowsColumnsPK ColumnsFKs
card_import0410
copy_nfc_codes483031710
importing_nfc_codes_operations40901110
nfc_codes505111311

Notification & Communication

TableEstimated RowsColumnsPK ColumnsFKs
automated_calls206651410
contacts491310
notification_logs0510
notifications385500810
notifications_new94248810
nova_notifications0910
onesignal_devices57849410

Order & Cart

TableEstimated RowsColumnsPK ColumnsFKs
carts372915
company_package_order_items461310
company_package_orders121910
deposit_orders1795051411
export_deposit_orders0800
export_orders6301700
export_withdraw_orders01100
free_subscription_orders32489521115
free_subscription_orders_details161844491113
free_subscriptions161971713
invoices284636713
maqsafy_product_order_items2259612
maqsafy_product_orders17231911
order_items32544042513
order_vending_details01312
orders15008805016
return_carts31116
return_invoices2101814
return_order_items242641714
return_orders164192415
supplier_carts6812
supplier_order_items52100912
supplier_orders513273112
tax_invoice_requests01110
withdraw_orders51231810

Other

TableEstimated RowsColumnsPK ColumnsFKs
cities156611
companies440321610
discount_reasons0510
excuses2501110
features751410
group_notes0712
groups01810
guide_manuals181010
importing_stock_operations01210
login_loggers18784510
mobile_verifications38691710
pages41010
questions33710
rates33507331311
regions18510
register_requests0810
service_provider_companies21510
settings7810
soft_pos11510
status_logs64211810
stock_logs229361513
store_landings01111
store_statistics2008535812
store_stocks616612
stores426635317
table_105898310
test5131800
top_sale362612
trips308712
tv_link_codes3810
vending_machines01012

Product & Catalog

TableEstimated RowsColumnsPK ColumnsFKs
block_products32041613
commission_packages261410
company_free_package_statistics676611
company_packages81710
favourites101811
free_packages212112
general_commission_packages0910
importing_products_operations01510
maqsafy_product_commission_packages91010
maqsafy_products171010
package_landings2611
product_categories101710
product_packages41854711
product_packages_products6558912
products30158111913
products_info1711111
push_notification_packages19810
service_provider_commission_packages11410
supplier_products14441612
withdraw_commission_packages0810

School & Education

TableEstimated RowsColumnsPK ColumnsFKs
classrooms82039711
educational_administrations60610
educational_levels18454711
educational_offices448811
export_schools02000
group_school0512
import_school421541110
maqsafy_school_products1459712
school_commission_packages71410
school_fee_classroom26512
school_fee_educational_level14512
school_fee_full_installment_payments0911
school_fee_installment_upfront_payments01111
school_fee_logs21312
school_fee_order_type_program_dates28711
school_fee_order_type_program_educational_levels155512
school_fee_order_type_programs341611
school_fee_order_types428701412
school_fee_orders20711611
school_fee_upfront_payments2711
school_fees2911
school_fees_discount_reasons0512
school_landings01411
school_managers01611
school_mobile_messages57912
school_notification_classrooms975713
school_notification_settings861711
school_page_visibility37953611
school_push_notification_packages381012
school_report_titles11510
school_reports33793210
schools431555815
schools_package425823910

Supplier & Company

TableEstimated RowsColumnsPK ColumnsFKs
automated_drivers134610
company_insights_statistecs1183611
company_page_visibility4368611
service_provider_company_page_visibility40611
supplier_categories350711
supplier_classifications29610
supplier_landings21011
supplier_store_classification167512
supplier_store_supplier_employee0612
supplier_stores2453110
supplier_stores_cities834512
supplier_stores_page_visibility4400611

System & Operations

TableEstimated RowsColumnsPK ColumnsFKs
action_events4418901710
export_data2848311210
failed_jobs384710
jobs0710
media5311810
migrations477310
nova_field_attachments0810
nova_pending_field_attachments0610
websockets_statistics_entries0710

User & Identity

TableEstimated RowsColumnsPK ColumnsFKs
company_packages_staffs0512
fcm_tokens25071510
guardians635800
importing_students_operations645232310
mobile_password_resets2519510
model_has_permissions0331
model_has_roles1213331
nfc_users896071514
password_resets100300
permissions505610
personal_access_tokens415271310
role_has_permissions3115222
roles24611
school_fee_order_types_staff29512
school_fee_student10512
school_notification_users8861811
school_number_users_log0612
staff_automated_calls671310
student_guardian32529912
student_school_fee_logs41511
student_school_fees101514
students_king_abdallah_balances3451000
supervisory_agencies9610
supervisory_agencies_stores807512
supervisory_agency_page_visibility48611
update_student_school_operations61210
user_bank_accounts34301210
user_landings6710
user_notification_targets35501611
user_notifications51610
userables3590641110
users3012006219

Wallet & Finance

TableEstimated RowsColumnsPK ColumnsFKs
bank_accounts0611
banks36710
export_transactions294805600
export_wallets22648210
girls_balances791000
mastercard_payments40710
money_transfers301617810
payment318471210
payouts01010
system_wallets101010
tax_inovices0910
transaction_issues125610
transactions58190511512
value_added_taxes0410
wallets4195491110
wallets_reports0910

Foreign Key Relationship Inventory

TableColumnReferenced TableReferenced Column
bank_accountsbank_idbanksid
block_productsguardian_idusersid
block_productsproduct_idproductsid
block_productsstudent_idusersid
cartsguardian_idusersid
cartsproduct_idproductsid
cartsseller_idusersid
cartsstore_idstoresid
cartsstudent_idusersid
citiesregion_idregionsid
classroomseducational_level_ideducational_levelsid
company_free_package_statisticscompany_idcompaniesid
company_insights_statistecscompany_idcompaniesid
company_packages_staffspackage_idcompany_packagesid
company_packages_staffsuser_idusersid
company_page_visibilitycompany_idcompaniesid
deposit_ordersorder_idordersid
educational_levelsschool_idschoolsid
educational_officeseducational_administration_ideducational_administrationsid
favouritesseller_idusersid
free_packagescompany_idcompaniesid
free_packagessupplier_store_idsupplier_storesid
free_subscription_orderscreator_idusersid
free_subscription_ordersfree_subscriptions_idfree_subscriptionsid
free_subscription_ordersseller_idusersid
free_subscription_ordersstores_idstoresid
free_subscription_ordersstudent_idusersid
free_subscription_orders_detailsorder_idfree_subscription_ordersid
free_subscription_orders_detailsseller_idusersid
free_subscription_orders_detailsstudent_idusersid
free_subscriptionsfree_packages_idfree_packagesid
free_subscriptionsschool_idschoolsid
free_subscriptionsstores_idstoresid
group_notesgroup_idgroupsid
group_notesuser_idusersid
group_schoolgroup_idgroupsid
group_schoolschool_idschoolsid
invoicescompany_idcompaniesid
invoicesorder_idordersid
invoicesstore_idstoresid
maqsafy_product_order_itemsmaqsafy_product_idmaqsafy_productsid
maqsafy_product_order_itemsmaqsafy_product_order_idmaqsafy_product_ordersid
maqsafy_product_ordersschool_idschoolsid
maqsafy_school_productsmaqsafy_products_idmaqsafy_productsid
maqsafy_school_productsschool_idschoolsid
model_has_permissionspermission_idpermissionsid
model_has_rolesrole_idrolesid
nfc_codesuserable_iduserablesid
nfc_usersnfc_code_idnfc_codesid
nfc_usersschool_idschoolsid
nfc_usersstudent_idusersid
nfc_usersuserable_iduserablesid
order_itemsorder_idordersid
order_itemsproduct_idproductsid
order_itemsstudent_idusersid
order_vending_detailsorder_idordersid
order_vending_detailsvending_machine_idvending_machinesid
ordersclassroom_idclassroomsid
orderseducational_level_ideducational_levelsid
ordersguardian_idusersid
ordersseller_idusersid
ordersstore_idstoresid
ordersstudent_idusersid
package_landingsuser_landing_iduser_landingsid
product_packagescompany_idcompaniesid
product_packages_productsproduct_idproductsid
product_packages_productsproduct_package_idproduct_packagesid
productscategory_idproduct_categoriesid
productscompany_idcompaniesid
productsstore_idstoresid
products_infocategory_idproduct_categoriesid
ratesstore_idstoresid
return_cartsguardian_idusersid
return_cartsorder_idordersid
return_cartsorder_item_idorder_itemsid
return_cartsproduct_idproductsid
return_cartsseller_idusersid
return_cartsstudent_idusersid
return_invoicescompany_idcompaniesid
return_invoicesorder_idordersid
return_invoicesreturn_order_idreturn_ordersid
return_invoicesstore_idstoresid
return_order_itemsorder_item_idorder_itemsid
return_order_itemsproduct_idproductsid
return_order_itemsreturn_order_idreturn_ordersid
return_order_itemsstudent_idusersid
return_ordersguardian_idusersid
return_ordersorder_idordersid
return_ordersseller_idusersid
return_ordersstore_idstoresid
return_ordersstudent_idusersid
role_has_permissionspermission_idpermissionsid
role_has_permissionsrole_idrolesid
rolesschool_idschoolsid
school_fee_classroomclassroom_idclassroomsid
school_fee_classroomschool_fee_idschool_feesid
school_fee_educational_leveleducational_level_ideducational_levelsid
school_fee_educational_levelschool_fee_idschool_feesid
school_fee_full_installment_paymentsschool_fee_idschool_feesid
school_fee_installment_upfront_paymentsschool_fee_idschool_feesid
school_fee_logscreated_idusersid
school_fee_logsstudent_school_fee_log_idstudent_school_fee_logsid
school_fee_order_type_program_datesschool_fee_order_type_program_idschool_fee_order_type_programsid
school_fee_order_type_program_educational_levelseducational_level_ideducational_levelsid
school_fee_order_type_program_educational_levelsschool_fee_order_type_program_idschool_fee_order_type_programsid
school_fee_order_type_programsschool_fee_order_type_idschool_fee_order_typesid
school_fee_order_typescommission_package_idservice_provider_commission_packagesid
school_fee_order_typesservice_provider_company_idservice_provider_companiesid
school_fee_order_types_staffschool_fee_order_type_idschool_fee_order_typesid
school_fee_order_types_staffuser_idusersid
school_fee_ordersprogram_idschool_fee_order_type_programsid
school_fee_studentschool_fee_idschool_feesid
school_fee_studentstudent_idusersid
school_fee_upfront_paymentsschool_fee_idschool_feesid
school_feesschool_idschoolsid
school_fees_discount_reasonsdiscount_reason_iddiscount_reasonsid
school_fees_discount_reasonsschool_fee_idschool_feesid
school_landingsuser_landing_iduser_landingsid
school_managersschool_idschoolsid
school_mobile_messagesmanager_idusersid
school_mobile_messagesschool_idschoolsid
school_notification_classroomsclassroom_idclassroomsid
school_notification_classroomseducational_level_ideducational_levelsid
school_notification_classroomsnotification_setting_idschool_notification_settingsid
school_notification_settingsschool_idschoolsid
school_notification_usersschool_notification_setting_idschool_notification_settingsid
school_number_users_logschool_idschoolsid
school_number_users_logstudent_idusersid
school_page_visibilityschool_idschoolsid
school_push_notification_packagespush_notification_idpush_notification_packagesid
school_push_notification_packagesschool_idschoolsid
schoolscity_idcitiesid
schoolseducational_administration_ideducational_administrationsid
schoolsmaqsafy_product_commission_package_idmaqsafy_product_commission_packagesid
schoolsoffice_ideducational_officesid
schoolsregion_idregionsid
service_provider_company_page_visibilitycompany_idservice_provider_companiesid
stock_logsproduct_idproductsid
stock_logsstore_idstoresid
stock_logsstore_stock_idstore_stocksid
store_landingsuser_landing_iduser_landingsid
store_statisticsproduct_idproductsid
store_statisticsstore_idstoresid
store_stocksproduct_idproductsid
store_stocksstore_idstoresid
storescommission_package_idcommission_packagesid
storescompany_idcompaniesid
storeseducational_administration_ideducational_administrationsid
storesoffice_ideducational_officesid
storesproduct_package_idproduct_packagesid
storesschool_idschoolsid
storessoft_pos_idsoft_posid
student_guardianguardian_idusersid
student_guardianstudent_idusersid
student_school_fee_logsstudent_school_fee_idstudent_school_feesid
student_school_feesdiscount_reason_iddiscount_reasonsid
student_school_feesschool_fee_idschool_feesid
student_school_feesschool_idschoolsid
student_school_feesstudent_idusersid
supervisory_agencies_storesstore_idstoresid
supervisory_agencies_storessupervisory_agency_idsupervisory_agenciesid
supervisory_agency_page_visibilitysupervisory_agency_idsupervisory_agenciesid
supplier_cartsstore_idstoresid
supplier_cartssupplier_product_idsupplier_productsid
supplier_categoriessupplier_store_idsupplier_storesid
supplier_landingsuser_landing_iduser_landingsid
supplier_order_itemssupplier_order_idsupplier_ordersid
supplier_order_itemssupplier_product_idsupplier_productsid
supplier_orderssupplier_idusersid
supplier_orderssupplier_store_idsupplier_storesid
supplier_productscategory_idsupplier_categoriesid
supplier_productssupplier_store_idsupplier_storesid
supplier_store_classificationsupplier_classification_idsupplier_classificationsid
supplier_store_classificationsupplier_store_idsupplier_storesid
supplier_store_supplier_employeesupplier_idusersid
supplier_store_supplier_employeesupplier_store_idsupplier_storesid
supplier_stores_citiescity_idcitiesid
supplier_stores_citiessupplier_store_idsupplier_storesid
supplier_stores_page_visibilitysupplier_stores_idsupplier_storesid
top_saleproduct_idproductsid
top_salestore_idstoresid
transactionsparent_idtransactionsid
transactionswallet_idwalletsid
tripsdriver_idusersid
tripssupplier_order_idsupplier_ordersid
user_notification_targetsuser_notification_iduser_notificationsid
usersclassroom_idclassroomsid
userscompany_idcompaniesid
userscreated_byusersid
userseducational_administration_ideducational_administrationsid
userseducational_level_ideducational_levelsid
usersoffice_ideducational_officesid
usersschool_idschoolsid
userssupervisory_agency_idsupervisory_agenciesid
userssupplier_store_idsupplier_storesid
vending_machinescompany_idcompaniesid
vending_machinesstore_idstoresid

Key Data Model Observations

  • The model contains multiple major domains: identity, schools, products, orders, wallet/finance, supplier/company, notifications, credentials/NFC, and operational/system tables.
  • The schema includes explicit foreign key relationships for many core tables, but a full application-level relationship review is still required because some Laravel models may define relationships not enforced as database foreign keys.
  • Credential/NFC-related tables exist, including nfc_codes, nfc_users, copy_nfc_codes, and card_import. This supports documenting credential inventory boundaries separately from dashboard NFC scanning.
  • High-volume tables should receive separate performance review: transactions, order_items, products, orders, wallets, and free subscription order tables.

Open Items

ItemStatusNotes
Confirm model relationships from Laravel codePartialDatabase foreign keys extracted; Eloquent relations still need code review.
Confirm sensitive columnsOpenRequires privacy/security review.
Confirm table owners by modulePartialCan be mapped from module names and route definitions.
Confirm archival strategy for high-volume tablesOpenRequired for performance and retention.