Skip to content

Commit

Permalink
Merge pull request #7 from uncinc/feature/template_file_readme_updates
Browse files Browse the repository at this point in the history
Feature/template file readme updates
  • Loading branch information
Nicasso committed Apr 14, 2023
2 parents 6ed62c8 + ffdaf3b commit 837c6d3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
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"}
}
}

0 comments on commit 837c6d3

Please sign in to comment.