DbToolsBundle
DbToolsBundle copied to clipboard
Anonymization filter on table
This is an issue for this comment: https://github.com/makinacorpus/DbToolsBundle/issues/138#issuecomment-2145158948
The idea is to allow anonymized table (or entity) to be filtered using user given conditions.
If I understood correctly @maxhelias use case, which is anonymizing some user table, but skipping some accounts anonymization (for example, your maintenance very special account, or people that will tests the QA version accounts).
This is a legit use case, we intend to find some elegant solution for this, although there are a few constraints:
- First I mentioned in the former issue that we could provide an event dispatcher and a few events that allows the API user to alter the update query. That's something we could implement, but it's not ideal because it's not configuration-driven.
- Secondly, in our internal roadmap, we plan to allow our users to dump the anonymization configuration into a single YAML file containing everything, thus allowing this tool to run via a standalone CLI (unconnected to Symfony) in order to run the anonymization process outside of the framework context.
So, here are a few ideas:
- Create a new attribute
AnonymizeFilter(string column$, string|array $conditions, bool $negate = false)for entities, which can be directly translated into a YAML data structure for YAML configuration. - Provide a few supported default conditions (basic comparisons really, such as
<,<=,=,>=,>,like, etc... - Provide a
rawoption which allows the user to directly write one or more SQL condition strings.
I'm not forgiving this issue! Our internal roadmap for the next versions is almost fixed, this is not part of it, but we are still discussing this topic from time to time. Once we'll have reached our current roadmap, this will be one of the next important topics.