DATABASE - letronghieu4897/magento GitHub Wiki

DATABASE

Database

Go Footer


1. Replace Sensitive Data When Use Database From Production

Go Header

Magento 1

UPDATE sales_flat_order SET customer_email = CONCAT(customer_id,"@netpower.test") WHERE customer_email NOT LIKE '%netpower.no';
  
UPDATE sales_flat_order SET customer_lastname = CONCAT("Lastname_",customer_id);
UPDATE sales_flat_order SET customer_firstname = CONCAT("Firstname_",customer_id);
 
UPDATE sales_flat_order_address SET firstname = CONCAT("Firstname_",customer_id);
UPDATE sales_flat_order_address SET lastname = CONCAT("Firstname_",customer_id);
UPDATE sales_flat_order_address SET telephone = "40 456 789";
UPDATE sales_flat_order_address SET email =  CONCAT(customer_id,"@netpower.test");
UPDATE sales_flat_order_address SET street =  CONCAT(customer_id," Sandnes");
  
UPDATE customer_entity SET email = CONCAT(entity_id,"@netpower.test") WHERE email NOT LIKE '%netpower.no';
UPDATE customer_entity_varchar SET value= "Firstname" where attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'firstname' AND entity_type_id = 1);
UPDATE customer_entity_varchar SET value= "Lastname" where attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'lastname' AND entity_type_id = 1);
UPDATE customer_entity_varchar SET value= "40 456 789" where attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'telephone' AND entity_type_id = 1);
  
UPDATE customer_address_entity_varchar SET value= "Firstname" where attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'firstname' AND entity_type_id = 2);
UPDATE customer_address_entity_varchar SET value= "Lastname" where attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'lastname' AND entity_type_id = 2);
UPDATE customer_address_entity_varchar SET value= "40 456 789"  where attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'telephone' AND entity_type_id = 2);
  
UPDATE newsletter_subscriber SET subscriber_email = CONCAT(subscriber_id,"@netpower.test") WHERE subscriber_email NOT LIKE '%netpower.no';

Magento 2

UPDATE sales_order SET customer_email = CONCAT(customer_id,"@netpower.test") WHERE customer_email NOT LIKE '%netpower.no';
  
UPDATE sales_order SET customer_lastname = CONCAT("Lastname_",customer_id);
UPDATE sales_order SET customer_firstname = CONCAT("Firstname_",customer_id);
  
UPDATE sales_order_address SET firstname = CONCAT("Firstname_",customer_id);
UPDATE sales_order_address SET lastname = CONCAT("Firstname_",customer_id);
UPDATE sales_order_address SET telephone = "40 456 789";
UPDATE sales_order_address SET email =  CONCAT(customer_id,"@netpower.test");
UPDATE sales_order_address SET street =  CONCAT(customer_id," Sandnes");
  
UPDATE customer_entity SET email = CONCAT(entity_id,"@netpower.test") WHERE email NOT LIKE '%netpower.no';
UPDATE customer_entity SET firstname = 'Firstname';
UPDATE customer_entity SET lastname = 'Firstname';
UPDATE customer_entity_varchar SET value= "Firstname" where attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'firstname' AND entity_type_id = 1);
UPDATE customer_entity_varchar SET value= "Lastname" where attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'lastname' AND entity_type_id = 1);
UPDATE customer_entity_varchar SET value= "40 456 789" where attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'telephone' AND entity_type_id = 1);
  
UPDATE customer_address_entity_varchar SET value= "Firstname" where attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'firstname' AND entity_type_id = 2);
UPDATE customer_address_entity_varchar SET value= "Lastname" where attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'lastname' AND entity_type_id = 2);
UPDATE customer_address_entity_varchar SET value= "40 456 789"  where attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'telephone' AND entity_type_id = 2);
  
UPDATE newsletter_subscriber SET subscriber_email = CONCAT(subscriber_id,"@netpower.test") WHERE subscriber_email NOT LIKE '%netpower.no';

Footer

Go Header