Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Run masquerade against a .sql file instead of database #99

Open
alexhert opened this issue Jul 18, 2022 · 4 comments
Open

Run masquerade against a .sql file instead of database #99

alexhert opened this issue Jul 18, 2022 · 4 comments

Comments

@alexhert
Copy link

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.

@peterjaap
Copy link
Contributor

I agree but I have no clue how to make that happen.

@toonvd
Copy link

toonvd commented Aug 18, 2022

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.

@peterjaap
Copy link
Contributor

@toonvd that looks interesting. But that will mean a very big rewrite since we now generate queries and run them against MySQL

public function createInsertOnUpdateStatement(int $totalRows, array $columns): \PDOStatement

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.

@toonvd
Copy link

toonvd commented Aug 18, 2022

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants