ALTER TABLE work_orders
  ADD COLUMN last_assigned_worker_id BIGINT REFERENCES worker_users(id) ON DELETE SET NULL;

CREATE INDEX idx_work_orders_last_worker
  ON work_orders(last_assigned_worker_id, status, id DESC);

COMMENT ON COLUMN work_orders.last_assigned_worker_id IS '最近一次接单的打手，超时/取消后保留，用于打手查看历史记录';
