-- v4.6 Workshop business fields
-- Adds delivery method, courier assignment and direct-order flag to service orders.

ALTER TABLE service_orders
    ADD COLUMN IF NOT EXISTS delivery_method VARCHAR(30),
    ADD COLUMN IF NOT EXISTS courier_id INTEGER REFERENCES couriers(id),
    ADD COLUMN IF NOT EXISTS is_direct BOOLEAN DEFAULT FALSE;

CREATE INDEX IF NOT EXISTS idx_service_orders_delivery_method ON service_orders(delivery_method);
CREATE INDEX IF NOT EXISTS idx_service_orders_courier_id ON service_orders(courier_id);
CREATE INDEX IF NOT EXISTS idx_service_orders_is_direct ON service_orders(is_direct);
