Skip to content

Instantly share code, notes, and snippets.

@AhmedSamy
Last active November 20, 2019 13:05
Show Gist options
  • Save AhmedSamy/bf282e59bdc65afc0a8e9bc26e6adcba to your computer and use it in GitHub Desktop.
Save AhmedSamy/bf282e59bdc65afc0a8e9bc26e6adcba to your computer and use it in GitHub Desktop.
Kill PEP
START TRANSACTION;
SET time_zone = 'Europe/Berlin';
SET @start_date = DATE_FORMAT(subdate(current_date, 1),'%Y-%m-%d 00:00:00');
SET @end_date = DATE_FORMAT(NOW(),'%Y-%m-%d 23:59:59');
UPDATE `risk_attributes` ra
SET ra.`initial_value` = ra.`attribute_value`, ra.`attribute_value` = 3, ra.`is_overwritten` = 1
WHERE ra.`attribute_name` IN ("count_compliance_summary")
AND ra.is_current = 1
AND ra.`attribute_value` = 2
AND (ra.created_at BETWEEN @start_date AND @end_date);
UPDATE `risk_attributes` ra
SET ra.`initial_value` = ra.`attribute_value`, ra.`attribute_value` = "b:1;", ra.`is_overwritten` = 1
WHERE ra.`attribute_name` IN ("ubos_pep_sanctions","company_pep_sanctions","singatories_pep_sanctions","all_ubos_found")
AND ra.is_current = 1
AND ra.`attribute_value` = "b:0;"
AND (ra.created_at BETWEEN @start_date AND @end_date);
UPDATE `risk_attributes` ra
SET ra.`initial_value` = ra.`attribute_value`, ra.`attribute_value` = "b:0;", ra.`is_overwritten` = 1
WHERE ra.`attribute_name` IN ("has_blacklist")
AND ra.is_current = 1
AND ra.`attribute_value` = "b:1;"
AND (ra.created_at BETWEEN @start_date AND @end_date);
UPDATE `risk_attributes` ra
SET ra.`attribute_value` = 1, ra.`initial_value` = 0, ra.`is_overwritten` = 1
WHERE ra.`attribute_name` = "valid_crefo_compliance_report"
AND ra.`attribute_value` = 0
AND ra.is_current=1
AND (ra.created_at BETWEEN @start_date AND @end_date);
COMMIT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment