-- v27 UI/API hardening for inventory/order/fulfilment flows.
-- Safe additive migration. Short index names are used intentionally for MySQL compatibility.

ALTER TABLE orders
  ADD INDEX ix_ord_grp_v27 (tenant_id, root_order_id, parent_order_id, requested_service_type, is_delete),
  ADD INDEX ix_ord_ful_v27 (tenant_id, warehouse_id, fulfilment_status, dispatch_queue_flag, is_delete);

ALTER TABLE order_items
  ADD INDEX ix_oi_ord_sku_v27 (tenant_id, order_id, sku_code, is_delete);

ALTER TABLE inventory_stocks
  ADD INDEX ix_inv_grid_v27 (tenant_id, client_id, warehouse_id, location_id, is_delete),
  ADD INDEX ix_inv_sku_v27 (tenant_id, sku_code, barcode, is_delete);

ALTER TABLE ready_for_dispatch
  ADD INDEX ix_rfd_ord_v27 (tenant_id, order_id, status),
  ADD INDEX ix_rfd_loc_v27 (tenant_id, putaway_location_id, status);
