-- Store Keeper Mobile API performance indexes and safety notes.
-- These indexes are additive and safe for existing WOTMS v13 databases.

CREATE INDEX idx_pick_tasks_mobile_queue ON pick_tasks (tenant_id, status, warehouse_id, is_delete, created_at);
CREATE INDEX idx_pack_tasks_mobile_queue ON pack_tasks (tenant_id, status, warehouse_id, is_delete, created_at);
CREATE INDEX idx_rfd_mobile_queue ON ready_for_dispatch (tenant_id, status, warehouse_id, is_delete, ready_at);
CREATE INDEX idx_manifest_mobile_handover ON manifests (tenant_id, status, warehouse_id, is_delete, created_at);
CREATE INDEX idx_manifest_orders_mobile_scan ON manifest_orders (tenant_id, manifest_id, handover_status, scan_status, is_delete);
CREATE INDEX idx_return_receiving_mobile_queue ON return_receivings (tenant_id, receiving_status, next_action, is_delete, created_at);
CREATE INDEX idx_wh_locations_mobile_scan ON warehouse_locations (tenant_id, barcode, full_code, status, is_delete);
CREATE INDEX idx_inventory_mobile_scan ON inventory_stocks (tenant_id, sku_code, barcode, warehouse_id, is_delete);
CREATE INDEX idx_parcel_mobile_scan ON parcel_holdings (tenant_id, parcel_no, awb_no, warehouse_id, is_delete);
CREATE INDEX idx_shipping_labels_mobile_scan ON shipping_labels (tenant_id, label_no, tracking_no, is_delete);
