-- New / moved modules (run once on existing DB)

UPDATE `app_modules`
SET `module_name` = 'Publication Year Wise Report'
WHERE `module_key` = 'publisher_year_wise_report';

UPDATE `app_modules`
SET `module_group` = 'Documents', `sort_order` = 186
WHERE `module_key` = 'weed_out_report';

INSERT IGNORE INTO `app_modules` (`module_key`, `module_name`, `module_group`, `route`, `sort_order`) VALUES
('accession_date_wise_report', 'Accession Date Wise Report', 'Catalogue', 'report/accession_date_wise_report', 123),
('budget_expenditure_report', 'Budget Expenditure Report', 'Acquisitions', 'report/budget_expenditure_report', 200),
('price_range_report', 'Price Range Report', 'Catalogue', 'report/price_range_report', 127);

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

INSERT IGNORE INTO `app_role_permissions` (`role_id`, `module_key`, `can_view`, `can_export`)
SELECT `role_id`, 'budget_expenditure_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`, 'price_range_report', `can_view`, `can_export`
FROM `app_role_permissions`
WHERE `module_key` = 'accession_register';
