INSERT IGNORE INTO permissions (name, display_name, module) VALUES
('sessions.view', 'View therapy sessions', 'sessions'),
('sessions.create', 'Create therapy sessions', 'sessions'),
('sessions.edit', 'Edit therapy sessions', 'sessions');

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','THERAPIST') AND p.name IN ('sessions.view','sessions.create','sessions.edit');
