-- Update amount_paid for existing purchases based on payment_status
-- If payment_status is 'paid', set amount_paid to total
-- If payment_status is 'partial' or 'credit', amount_paid remains as is (may need manual adjustment)

UPDATE purchases SET amount_paid = total WHERE payment_status = 'paid' AND amount_paid = 0;
