Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/template file readme updates #7

Merged
merged 3 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and can in principle dump any database that PDO supports.

## How to use

*Scroll down a bit for usage with Drush.*

There are presently two ways of manipulating data,
the first is by manipulating the actual SQL queries that are run on the server (given by the gdpr-expressions path),
and the second is by replacing column output before the dump is generated (given by the gdpr-replacements option).
Expand Down Expand Up @@ -75,7 +77,7 @@ You can also save replacements mapping to JSON file and use it with `--gdpr-repl
## Use with drush

As this mimicks mysqldump, it can be use with drush, backup_migrate and any tool that uses mysqldump.
Drush example:
Example for your local Docker instance:

```
$ export PATH=/var/www/html/vendor/bin:$PATH
Expand All @@ -84,6 +86,14 @@ $ which mysqldump
$ drush sql-dump --tables-list=users_field_data --extra-dump=$'--gdpr-expressions=\'{"users_field_data":{"name":"uid","mail":"uid","init":"uid","pass":"\\"\\""}}\' --debug-sql'
```

On Staging, Accept or Production environments you probably want to do the following (replace `environment.nl`):
```
$ export PATH=/data/www/environment.nl/current/vendor/bin/mysqldump:$PATH
$ pwd
/data/www/environment.nl/current
$ drush sql-dump --extra-dump='--gdpr-replacements-file=../gdpr-replacements.json' --result-file=gdpr-dump.sql
```
If your project does not have a `gdpr-replacements.json` please use the template from this project and add one.
### MySqlOptions file

You are able to have your gdpr-expressions/replacement options set in a mysql options file file.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"phpunit/phpunit": "^7.2"
"phpunit/phpunit": "^8"
},
"config": {
"allow-plugins": {
Expand Down
20 changes: 20 additions & 0 deletions gdpr-replacements-template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"users_field_data": {
"name": {"formatter": "clear"},
"mail": {"formatter": "email"},
"init": {"formatter": "clear"},
"pass": {"formatter": "clear"},
"_exclude": {"mail": ["*@uncinc.nl"], "uid": ["0", "1"]}
},
"profile__field_address": {
"field_address_locality": {"formatter": "city"},
"field_address_dependent_locality": {"formatter": "clear"},
"field_address_postal_code": {"formatter": "postcode"},
"field_address_address_line1": {"formatter": "streetName"},
"field_address_address_line2": {"formatter": "buildingNumber"}
},
"profile__field_first_name": {
"field_first_name_value": {"formatter": "firstName"}
}
}