INSERT IGNORE INTO permissions (name, display_name, description) VALUES
('patients.view','View patients','View patient records'),
('patients.create','Create patients','Create patient records'),
('patients.edit','Edit patients','Edit patient records');

INSERT IGNORE INTO role_permissions (role_id, permission_id)
SELECT r.id, p.id FROM roles r CROSS JOIN permissions p
WHERE r.name IN ('SUPER_ADMIN','ADMIN') AND p.name IN ('patients.view','patients.create','patients.edit');
