masquerade
masquerade copied to clipboard
Run masquerade against a .sql file instead of database
is it possible to run this agains an mysqldump ? it would be great to masquerade an existing mysql backup instead of changing data on database itself.
I agree but I have no clue how to make that happen.
Another approach could be made possible using https://github.com/ifsnop/mysqldump-php. Another lib https://github.com/heyday/laravel-anonymised-sql-dumps uses it.
@toonvd that looks interesting. But that will mean a very big rewrite since we now generate queries and run them against MySQL https://github.com/elgentos/masquerade/blob/39baae746b12bba869fe582ea6b322fbbdef1da4/src/Elgentos/Masquerade/DataProcessor/TableService.php#L355
If we were to use mysqldump-php
, we'll have to rewrite everything to transform callables like this https://github.com/ifsnop/mysqldump-php#changing-values-when-exporting
Doable, but a lot of work. Not sure if it's worth the hassle.
It depends on your requirements indeed, for me, a stream using an anonymous mysqldump would mean a lot less i/o when migrating DBs. Also, it avoids anonimising the wrong (production) DB by mistake. I guess this could be a separate project.