182 lines
6.9 KiB
SQL
182 lines
6.9 KiB
SQL
create or replace procedure eft_nom.cleanup_testdata IS
|
|
--
|
|
-- Removes all test data, do not run unles certain you are connected to the right database.
|
|
-- Note this will not COMMIT automatically.
|
|
--
|
|
BEGIN
|
|
--
|
|
DELETE message_recipient;
|
|
--
|
|
DELETE bulletin_board_messages;
|
|
--
|
|
DELETE contract_rules
|
|
WHERE cont_id IN (SELECT cont_id
|
|
FROM contracts
|
|
WHERE contract_number IN ('PUW_EDEN1','PUW_EDEN2',
|
|
'OMT_EDEN1','OMT_EDEN2'));
|
|
--
|
|
DELETE contract_template_rules
|
|
WHERE cote_id IN (SELECT cote_id
|
|
FROM contract_templates
|
|
WHERE NAME = 'EDEN GRC_contracts');
|
|
--
|
|
DELETE rules
|
|
WHERE rule_name IN ('E_rl_R_m3max','E_rl_R_m3min','E_rl_Dmu_m3max','E_rl_Dmu_m3min',
|
|
'E_rl_Qmu_m3max','E_rl_Qmu_m3min','E_rl_Ymu_m3max','E_rl_Ymu_m3min');
|
|
--
|
|
DELETE contract_template_params
|
|
WHERE pars_id IN (SELECT pars_id
|
|
FROM PARAMETERS
|
|
WHERE cate_id IN (SELECT cate_id
|
|
FROM categories
|
|
WHERE code IN ('EDEN_Request_m3day','EDEN_D_makeup_m3day',
|
|
'EDEN_Q_makeup_m3day','EDEN_Y_makeup_m3day'))
|
|
);
|
|
--
|
|
DELETE cont_net_point_param_vals
|
|
WHERE conp_id IN (SELECT conp_id
|
|
FROM cont_network_points
|
|
WHERE nepo_id IN (SELECT nepo_id
|
|
FROM network_points
|
|
WHERE NAME IN ('EDEN HAG','EDEN TSTV')));
|
|
--
|
|
DELETE contract_parameters
|
|
WHERE cont_id IN (SELECT cont_id
|
|
FROM contracts
|
|
WHERE contract_number IN ('PUW_EDEN1','PUW_EDEN2','OMT_EDEN1','OMT_EDEN2'));
|
|
--
|
|
DELETE nom_net_point_cat_vals
|
|
WHERE conp_id IN (SELECT conp_id
|
|
FROM cont_network_points
|
|
WHERE nepo_id IN (SELECT nepo_id
|
|
FROM network_points
|
|
WHERE NAME IN ('EDEN HAG','EDEN TSTV')));
|
|
--
|
|
DELETE cont_network_points
|
|
WHERE conp_id IN (SELECT conp_id
|
|
FROM cont_network_points
|
|
WHERE nepo_id IN (SELECT nepo_id
|
|
FROM network_points
|
|
WHERE NAME IN ('EDEN HAG','EDEN TSTV')));
|
|
--
|
|
DELETE network_points
|
|
WHERE NAME IN ('EDEN HAG','EDEN TSTV');
|
|
--
|
|
DELETE contract_categories
|
|
WHERE cont_id IN (SELECT cont_id
|
|
FROM contracts
|
|
WHERE contract_number IN ('PUW_EDEN1','PUW_EDEN2',
|
|
'OMT_EDEN1','OMT_EDEN2'));
|
|
--
|
|
DELETE contract_template_categories
|
|
WHERE cote_id IN (SELECT cote_id
|
|
FROM contract_templates
|
|
WHERE NAME = 'EDEN GRC_contracts');
|
|
--
|
|
DELETE conf_net_point_cat_vals
|
|
WHERE nomi_id IN (SELECT nomi_id
|
|
FROM nominations
|
|
WHERE cont_id IN (SELECT cont_id
|
|
FROM contracts
|
|
WHERE contract_number IN ('PUW_EDEN1','PUW_EDEN2',
|
|
'OMT_EDEN1','OMT_EDEN2')));
|
|
--
|
|
DELETE confirmations
|
|
WHERE nomi_id IN (SELECT nomi_id
|
|
FROM nominations
|
|
WHERE cont_id IN (SELECT cont_id
|
|
FROM contracts
|
|
WHERE contract_number IN ('PUW_EDEN1','PUW_EDEN2',
|
|
'OMT_EDEN1','OMT_EDEN2')));
|
|
--
|
|
DELETE nominations
|
|
WHERE nomi_id IN (SELECT nomi_id
|
|
FROM nominations
|
|
WHERE cont_id IN (SELECT cont_id
|
|
FROM contracts
|
|
WHERE contract_number IN ('PUW_EDEN1','PUW_EDEN2',
|
|
'OMT_EDEN1','OMT_EDEN2')));
|
|
|
|
--
|
|
DELETE contracts
|
|
WHERE cont_id IN (SELECT cont_id
|
|
FROM contracts
|
|
WHERE contract_number IN ('PUW_EDEN1','PUW_EDEN2',
|
|
'OMT_EDEN1','OMT_EDEN2'));
|
|
--
|
|
DELETE contract_templates
|
|
WHERE NAME = 'EDEN GRC_contracts';
|
|
--
|
|
DELETE PARAMETERS
|
|
WHERE cate_id IN (SELECT cate_id
|
|
FROM categories
|
|
WHERE code IN ('EDEN_Request_m3day','EDEN_D_makeup_m3day',
|
|
'EDEN_Q_makeup_m3day','EDEN_Y_makeup_m3day')
|
|
);
|
|
--
|
|
DELETE categories
|
|
WHERE cate_id IN (SELECT cate_id
|
|
FROM categories
|
|
WHERE code IN ('EDEN_Request_m3day','EDEN_D_makeup_m3day',
|
|
'EDEN_Q_makeup_m3day','EDEN_Y_makeup_m3day'));
|
|
--
|
|
--DELETE nom_window_customers;
|
|
--
|
|
--DELETE nomination_windows;
|
|
--
|
|
--DELETE document_timestamps;
|
|
--
|
|
/*DELETE user_profiles
|
|
WHERE syus_id NOT IN (48,97,106,107);
|
|
--
|
|
DELETE subscription_contacts
|
|
WHERE uscd_id NOT IN (SELECT uscd_id
|
|
FROM user_contact_details
|
|
WHERE syus_id IN (48,97,106,107));
|
|
--
|
|
DELETE user_contact_details
|
|
WHERE syus_id NOT IN (48,97,106,107);
|
|
--
|
|
DELETE user_homepage
|
|
WHERE syus_id NOT IN (48,97,106,107);
|
|
--
|
|
DELETE user_options
|
|
WHERE syus_id NOT IN (48,97,106,107);
|
|
--
|
|
DELETE intermediary_users
|
|
WHERE syus_id NOT IN (48,97,106,107)
|
|
AND inte_id NOT IN (SELECT inte_id
|
|
FROM customer_intermediaries
|
|
WHERE cust_id IN (9,700,701));
|
|
--
|
|
DELETE system_users
|
|
WHERE syus_id NOT IN (48,97,106,107)
|
|
AND inte_id NOT IN (SELECT inte_id
|
|
FROM customer_intermediaries
|
|
WHERE cust_id IN (9,700,701));
|
|
--
|
|
DELETE intermediaries
|
|
WHERE inte_id NOT IN (SELECT inte_id
|
|
FROM customer_intermediaries
|
|
WHERE cust_id IN (9,700,701));
|
|
--
|
|
DELETE customer_intermediaries
|
|
WHERE cust_id NOT IN (9,700,701)
|
|
AND cust_id NOT IN (SELECT cust_id
|
|
FROM system_users
|
|
WHERE syus_id IN (48,97,106,107));
|
|
--
|
|
DELETE customers
|
|
WHERE cust_id NOT IN (9,700,701)
|
|
AND cust_id NOT IN (SELECT cust_id
|
|
FROM system_users
|
|
WHERE syus_id IN (48,97,106,107));
|
|
--*/
|
|
DELETE debug_options;
|
|
--
|
|
DELETE DEBUG;
|
|
--
|
|
end cleanup_testdata;
|
|
/
|
|
|