So to make my project GDPR friendly, I have to remove all customer data after 90 days.
This is how the sales
table looks like (the input is just for example), using phpMyAdmin:
| ID | CUSTOMER | EMAIL | PRODUCT | DATE |
| 1 | Ken James | [email protected] | 4816419 | 2019-12-25 10:26:19 |
| 2 | Amy Wen | [email protected] | 6662341 | 2019-11-23 10:26:19 |
| 3 | Chris Pet | [email protected] | 4816419 | 2019-05-05 10:26:19 |
Is there somehow I can automatically replace the CUSTOMER
and EMAIL
with just XXXXXX
if the DATE
is older then 90 days?
3
Answers
You can use the built on Scheduler.
But it has to be Enabled
You can do as follows:
CURRENT_DATE() return the date of the current date
(You can also use GETDATE() instead of CURRENT_DATE())
This is perhaps too long for a comment.
90 days seems a bit aggressive based on what I know about GDPR.
That said, what you are doing is quite dangerous, at least from an analytic and financial perspective. Knowing that a customer has made multiple purchases over time can be quite important. And GDPR is pretty explicit that you can keep historical information about active (and recently former) customers. (Of course, I’m not a lawyer and even if I were, you should be very suspicious about free advie over the web.)
That said, your
sales
table should be designed to be privacy compliant. How? Store the customer information in a different table.So, the
sales
table should look like:This table is perfectly fine from a privacy perspective, assuming that the
CUSTOMERID
is strictly used internally.You should then have a
CUSTOMERS
table:This is the table where you can replace the name, address, email, phone number, and so on with
NULL
values (or'XXXX'
if you prefer).This structure allows you to maintain the internal history of repeated purchases and purchase dates and so on — even when the data has been anonymized. By putting all the PII in one place, it is easier to maintain, audit, and ensure that it meets the requirements of GDPR and other privacy laws.