INSERT INTO permissions (name, display_name) VALUES
('payment.view', 'View payments and receipts'),
('payment.create', 'Record payments'),
('payment.void', 'Void payments'),
('receipt.view', 'View receipts')
ON DUPLICATE KEY UPDATE display_name = VALUES(display_name);

INSERT IGNORE INTO role_permissions (role_id, permission_id)
SELECT r.id, p.id FROM roles r JOIN permissions p
WHERE r.name = 'ADMIN' AND p.name IN ('payment.view','payment.create','payment.void','receipt.view');
