Provides drush commands for yaml sanitization files checks and generation.
Provides a set of drush commands to assist in generating a
database.sanitize.yml file containing all the queries for database sanitization.
db-sanitize-analyze (dbsa)Compares existing
database.sanitize.ymlfiles on the site installation against existing database tables and list tables that needs to be verified and possibly sanitized.
db-sanitize-generate (dbsg)generates a
database.sanitize.ymlfile for all tables not specified in
Use the option
--file to specify a YML file and skip the scan.
This is meant to be used alongside merge-yaml composer plugin, so that when you build your local environment for a drupal site, an
database.sanitize.merge.yml file will be generated. This file's path is what you're expected to pass in.
You can provide a
database.sanitize.yml file containing queries for database sanitization for your module or profile.
sanitize: MACHINE_NAME: DBTABLENAME1: description: 'query description' query: 'DB QUERY 1' DBTABLENAME2: description: 'query description' query: 'DB QUERY 2' MACHINE_NAME2: DBTABLENAME3: description: 'query description' query: 'DB QUERY 3' DBTABLENAME4: false DBTABLENAMEPREFIX*: false
Using a wildcard
* for table names is supported. For example, setting
node_revision* will apply to all tables names starting with
To find out how many tables needs to be defined in
# Specifying a file. drush dbsa --file=/var/www/SITE/NON-PUBLIC-FOLDER/database.sanitize.merge.yml
To get the YAML file content for the missing tables to be sanitized:
drush dbsg --machine-name="my_module"
To save the missing tables to a
drush dbsg --machine-name="MY_profile" > docroot/profiles/MY_profile/database.sanitize.yml
The generated queries for each missing table default to
TRUNCATE TABLE $table. Developers are expected to assess what content should be sanitized for each table and edit the file accordingly.
This repository is integrated with Travis CI to perform tests and detect Drupal coding standards violations.
You will need to:
- Run composer install.
- Run composer install inside the
- Within the root of the package, run this command adjusting
UNISH_DB_URLwith your database configuration.
UNISH_DB_URL="mysql://USERNAME:PASSWORD@127.0.0.1" UNISH_NO_TIMEOUTS=y vendor/drush/drush/vendor/bin/phpunit --configuration "vendor/drush/drush/tests" drush/tests/