Skip to content

Instantly share code, notes, and snippets.

@perifer
Last active September 28, 2015 03:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save perifer/1376488 to your computer and use it in GitHub Desktop.
Save perifer/1376488 to your computer and use it in GitHub Desktop.
Clean up Drupal 6 db dump
-- Munge emails and reset passwords.
UPDATE users SET mail = CONCAT(name, '@localhost'), init = CONCAT(name, '@localhost'), pass = 'pass';
-- UPDATE authmap SET authname = CONCAT(aid, '@localhost');
-- Remove irrelevant data that bulks up the dump and contains IP-addresses
TRUNCATE cache;
TRUNCATE cache_block;
TRUNCATE cache_bootstrap;
TRUNCATE cache_field;
TRUNCATE cache_filter;
TRUNCATE cache_form;
TRUNCATE cache_image;
TRUNCATE cache_l10n_update;
TRUNCATE cache_media_xml;
TRUNCATE cache_menu;
TRUNCATE cache_page;
TRUNCATE cache_path;
TRUNCATE cache_token;
TRUNCATE cache_update;
TRUNCATE cache_views;
TRUNCATE cache_views_data;
TRUNCATE flood;
TRUNCATE history;
TRUNCATE search_dataset;
TRUNCATE search_index;
TRUNCATE search_total;
TRUNCATE sessions;
TRUNCATE watchdog;
-- Munge emails and reset passwords.
UPDATE users SET mail = CONCAT(name, '@localhost'), init = CONCAT(name, '@localhost'), pass = MD5('pass');
UPDATE comments SET mail = CONCAT(name, '@localhost');
-- UPDATE authmap SET authname = CONCAT(aid, '@localhost');
-- Remove scraped user data
TRUNCATE novalogin_userdata;
-- Clear out old webform entries which likely include e-mails
UPDATE webform_submitted_data set data='SCRUBBED';
-- Remove irrelevant data that bulks up the dump and contains IP-addresses
TRUNCATE access;
TRUNCATE cache_block;
TRUNCATE cache_content;
TRUNCATE cache_filter;
TRUNCATE cache_form;
TRUNCATE cache_menu;
TRUNCATE cache_novalogin;
TRUNCATE cache_page;
TRUNCATE cache_rules;
TRUNCATE cache_update;
TRUNCATE cache_views;
TRUNCATE cache_views_data;
TRUNCATE devel_queries;
TRUNCATE devel_times;
TRUNCATE flood;
TRUNCATE history;
TRUNCATE search_dataset;
TRUNCATE search_index;
TRUNCATE search_total;
TRUNCATE sessions;
TRUNCATE watchdog;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment