-- Add Subject Wise + Patent catalogue reports (run once on existing DB)
INSERT IGNORE INTO `app_modules` (`module_key`, `module_name`, `module_group`, `route`, `sort_order`) VALUES
('subject_wise_report', 'Subject Wise Report', 'Catalogue', 'report/subject_wise_report', 81),
('patent_report', 'Patent Report', 'Catalogue', 'report/patent_report', 82);

-- Copy permissions from Accession Register for roles that already have it
INSERT IGNORE INTO `app_role_permissions` (`role_id`, `module_key`, `can_view`, `can_export`)
SELECT `role_id`, 'subject_wise_report', `can_view`, `can_export`
FROM `app_role_permissions`
WHERE `module_key` = 'accession_register';

INSERT IGNORE INTO `app_role_permissions` (`role_id`, `module_key`, `can_view`, `can_export`)
SELECT `role_id`, 'patent_report', `can_view`, `can_export`
FROM `app_role_permissions`
WHERE `module_key` = 'accession_register';
