<commit_before>--
-- Kuali Coeus, a comprehensive research administration system for higher education.
--
-- Copyright 2005-2015 Kuali, Inc.
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Affero General Public License as
-- published by the Free Software Foundation, either version 3 of the
-- License, or (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU Affero General Public License for more details.
--
-- You should have received a copy of the GNU Affero General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
--

update PROPOSAL_TYPE set PROPOSAL_TYPE_CODE = '500' where PROPOSAL_TYPE_CODE = '10' and DESCRIPTION = 'New - Change/Corrected' and UPDATE_USER = 'admin';
update PROPOSAL_TYPE set PROPOSAL_TYPE_CODE = '501' where PROPOSAL_TYPE_CODE = '14' and DESCRIPTION = 'Pre Proposal' and UPDATE_USER = 'admin';
update PROPOSAL_TYPE set PROPOSAL_TYPE_CODE = '502' where PROPOSAL_TYPE_CODE = '15' and DESCRIPTION = 'Supplement-Changed/Corrected' and UPDATE_USER = 'admin';
update PROPOSAL_TYPE set PROPOSAL_TYPE_CODE = '503' where PROPOSAL_TYPE_CODE = '16' and DESCRIPTION = 'Resubmission-Changed/Corrected' and UPDATE_USER = 'admin';
update PROPOSAL_TYPE set PROPOSAL_TYPE_CODE = '504' where PROPOSAL_TYPE_CODE = '17' and DESCRIPTION = 'Budget-SOW Update' and UPDATE_USER = 'admin';
update PROPOSAL_TYPE set PROPOSAL_TYPE_CODE = '505' where PROPOSAL_TYPE_CODE = '18' and DESCRIPTION = 'Renewal-Changed/Corrected' and UPDATE_USER = 'admin';

update KRCR_PARM_T set VAL='500' where NMSPC_CD = 'KC-PD' and PARM_NM = 'PROPOSAL_TYPE_CODE_NEW_CHANGE_CORRECTED' and VAL = '10';
update KRCR_PARM_T set VAL='501' where NMSPC_CD = 'KC-PD' and PARM_NM = 'PROPOSAL_TYPE_CODE_PRE_PROPOSAL' and VAL = '14';<commit_msg>update to script to handle foreign keys<commit_after>--
-- Kuali Coeus, a comprehensive research administration system for higher education.
--
-- Copyright 2005-2015 Kuali, Inc.
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Affero General Public License as
-- published by the Free Software Foundation, either version 3 of the
-- License, or (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU Affero General Public License for more details.
--
-- You should have received a copy of the GNU Affero General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
--

DELIMITER /

create procedure updateProposalType(in curProposalType varchar(3), in newProposalType varchar(3), in curDesc varchar(200))
	begin
		declare dbProposalType varchar(3) default null;

		select proposal_type_code into dbProposalType from proposal_type where proposal_type_code = curProposalType and description = curDesc and update_user = 'admin';
		if dbProposalType is not null then
			insert into proposal_type values ('999', 'TEMP', NOW(), 'admin', 1, UUID());
			update proposal_log set proposal_type_code = '999' where proposal_type_code = dbProposalType;
			update proposal set proposal_type_code = '999' where proposal_type_code = dbProposalType;
			update eps_proposal set proposal_type_code = '999' where proposal_type_code = dbProposalType;
			update proposal_type set proposal_type_code = newProposalType where proposal_type_code = dbProposalType;
			update proposal_log set proposal_type_code = newProposalType where proposal_type_code = '999';
			update proposal set proposal_type_code = newProposalType where proposal_type_code = '999';
			update eps_proposal set proposal_type_code = newProposalType where proposal_type_code = '999';
			delete from proposal_type where proposal_type_code = '999';
		end if;
	end /
	
DELIMITER ;
			
call updateProposalType('10', '500', 'New - Change/Corrected');
call updateProposalType('14', '501', 'Pre Proposal');
call updateProposalType('15', '502', 'Supplement-Changed/Corrected');
call updateProposalType('16', '503', 'Resubmission-Changed/Corrected');
call updateProposalType('17', '504', 'Budget-SOW Update');
call updateProposalType('18', '505', 'Renewal-Changed/Corrected');

drop procedure updateProposalType;

update KRCR_PARM_T set VAL='500' where NMSPC_CD = 'KC-PD' and PARM_NM = 'PROPOSAL_TYPE_CODE_NEW_CHANGE_CORRECTED' and VAL = '10';
update KRCR_PARM_T set VAL='501' where NMSPC_CD = 'KC-PD' and PARM_NM = 'PROPOSAL_TYPE_CODE_PRE_PROPOSAL' and VAL = '14';
{'fraction_non_alphanumeric': 0.08999791188139486, 'fraction_numerical': 0.026936730006264356, 'mean_word_length': 5.017587939698492, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3442633', 'n_tokens_mistral': 1589, 'n_tokens_neox': 1427, 'n_words': 523}