ALTER TABLE bazzar_pos.sales_orders
    ADD COLUMN IF NOT EXISTS payment_method VARCHAR(30),
    ADD COLUMN IF NOT EXISTS paid_amount NUMERIC(14,2) NOT NULL DEFAULT 0,
    ADD COLUMN IF NOT EXISTS change_amount NUMERIC(14,2) NOT NULL DEFAULT 0,
    ADD COLUMN IF NOT EXISTS customer_origin JSONB NOT NULL DEFAULT '{}'::jsonb;

UPDATE bazzar_pos.sales_orders
SET payment_method = COALESCE(payment_method, 'cash')
WHERE payment_method IS NULL;

