-- 0003_orders_jsonb_proof.sql

-- 1. Create a temporary column
ALTER TABLE orders ADD COLUMN proof_data_new JSONB DEFAULT '[]'::jsonb;

-- 2. Migrate existing data
UPDATE orders 
SET proof_data_new = jsonb_build_array(proof_data) 
WHERE proof_data IS NOT NULL AND proof_data != '';

-- 3. Drop old column and rename new one
ALTER TABLE orders DROP COLUMN proof_data;
ALTER TABLE orders RENAME COLUMN proof_data_new TO proof_data;
