INSERT INTO permissions (name, display_name) VALUES
('invoice.create', 'Create and manage invoices'),
('invoice.view', 'View invoices')
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 ('invoice.create','invoice.view');
