Skip to content

Instantly share code, notes, and snippets.

@standa
Forked from vojtagrec/cleanup.sql
Last active October 1, 2015 11:09

Revisions

  1. standa revised this gist Oct 1, 2015. 1 changed file with 4 additions and 10 deletions.
    14 changes: 4 additions & 10 deletions cleanup.sql
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,12 @@
    -- example.com emails for all customers
    UPDATE customer_entity
    SET email='test@example.com'
    SET email=CONCAT(OLD_PASSWORD(email), '@example.com')
    WHERE email NOT LIKE '%aardvark%' AND email NOT LIKE '%keyup%' AND email NOT LIKE '%grec.cz';

    -- example.com emails for all orders
    UPDATE sales_flat_order_address
    SET email=NULL;
    SET email=CONCAT(OLD_PASSWORD(email), '@example.com');
    UPDATE sales_flat_order
    SET customer_email=NULL;
    SET customer_email=CONCAT(OLD_PASSWORD(customer_email), '@example.com');

    -- change magento domain to staging.*
    UPDATE core_config_data
    SET value = REPLACE(value, 'www', 'staging')
    WHERE path LIKE '%base_url';

    -- disable email gateways
    UPDATE m_helpdesk_gateway SET is_active = 0
    WHERE path LIKE '%base_url';
  2. standa revised this gist Jan 12, 2015. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion cleanup.sql
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,18 @@
    -- example.com emails for all customers
    UPDATE customer_entity
    SET email='[email protected]'
    WHERE email NOT LIKE '%aardvark%' AND email NOT LIKE '%keyup%' AND email NOT LIKE '%grec.cz';

    -- example.com emails for all orders
    UPDATE sales_flat_order_address
    SET email=NULL;
    UPDATE sales_flat_order
    SET customer_email=NULL;

    -- change magento domain to staging.*
    UPDATE core_config_data
    SET value = REPLACE(value, 'www', 'staging')
    WHERE path LIKE '%base_url';
    WHERE path LIKE '%base_url';

    -- disable email gateways
    UPDATE m_helpdesk_gateway SET is_active = 0
  3. @vojtagrec vojtagrec created this gist Jul 16, 2013.
    12 changes: 12 additions & 0 deletions cleanup.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    UPDATE customer_entity
    SET email='[email protected]'
    WHERE email NOT LIKE '%aardvark%' AND email NOT LIKE '%keyup%' AND email NOT LIKE '%grec.cz';

    UPDATE sales_flat_order_address
    SET email=NULL;
    UPDATE sales_flat_order
    SET customer_email=NULL;

    UPDATE core_config_data
    SET value = REPLACE(value, 'www', 'staging')
    WHERE path LIKE '%base_url';
    1 change: 1 addition & 0 deletions db_export.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    nice -n16 php -dsuhosin.executor.include.whitelist="phar" n98-magerun.phar db:dump -s "am_notfound_* report_viewed_product_index @stripped"