# Model Schema Session - 2026-03-17

Purpose: Record the agreed table schema alignment for model updates so future changes are quick and consistent.

## Tables Covered
- customers
- tbl_packages
- tbl_order
- tbl_customer_subscriptions

## Key Column Mapping Decisions
- customers
  - Primary identifier used for relationships: `sms_cust_id`
  - External client identifier: `client_cust_id`

- tbl_order
  - Customer link column: `sms_cust_id` (FK to customers.sms_cust_id)
  - Order link column for subscriptions: `sms_order_id`
  - Package link column for orders: `sms_package_id`

- tbl_customer_subscriptions
  - Customer link column: `sms_cust_id` (FK to customers.sms_cust_id)
  - Order link column: `sms_order_id` (FK to tbl_order.sms_order_id)
  - Package link column: `sms_package_id` (FK to tbl_packages.sms_package_id)

- tbl_packages
  - Package link column for subscriptions: `sms_package_id`

## Model Files Updated
- app/Models/Customer.php
- app/Models/Package.php
- app/Models/Order.php
- app/Models/CustomerSubscription.php

## Notes For Future Updates
- Keep `sms_*` columns as the primary join keys between orders/subscriptions/customers.
- If you add or rename columns in these tables, update both `$fillable` and `$casts` in the matching model.
- tbl_packages uses `created_at` and `modified_at` for Laravel timestamps; `updated_at` exists as a normal column.
- `sms_cust_id`, `sms_order_id`, and `sms_package_id` are `varchar` identifiers (not numeric) in the current schema.
