Skip to content

Commit a7218ff

Browse files
authored
Merge pull request #14150 from pacodelaluna/improve-truncate-and-anonymize-rake-tasks
Improve Truncate and Anonymize Rake tasks
2 parents 2785701 + 9ee457b commit a7218ff

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

lib/tasks/data/anonymize_data.rake

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,22 @@ namespace :ofn do
4343
def anonymize_users_data
4444
Spree::User.update_all("email = concat(id, '_ofn_user@example.com'),
4545
login = concat(id, '_ofn_user@example.com'),
46-
unconfirmed_email = concat(id, '_ofn_user@example.com')")
46+
unconfirmed_email = concat(id, '_ofn_user@example.com'),
47+
current_sign_in_ip = '0.0.0.0',
48+
last_sign_in_ip = '0.0.0.0'")
4749
Customer.where(user_id: nil)
4850
.update_all("email = concat(id, '_ofn_customer@example.com'),
4951
name = concat('Customer Number ', id, ' (without connected User)'),
5052
first_name = concat('Customer Number ', id),
5153
last_name = '(without connected User)'")
5254
Customer.where.not(user_id: nil)
53-
.update_all("email = concat(user_id, '_ofn_user@example.com'),
55+
.update_all("email = concat(user_id, '_ofn_user+customer_', id, '@example.com'),
5456
name = concat('Customer Number ', id, ' - User ', user_id),
5557
first_name = concat('Customer Number ', id),
5658
last_name = concat('User ', user_id)")
5759

58-
Spree::Order.update_all("email = concat(id, '_ofn_order@example.com')")
60+
Spree::Order.update_all("email = concat(id, '_ofn_order@example.com'),
61+
last_ip_address = '0.0.0.0'")
5962
end
6063

6164
def anonymize_payments_data

lib/tasks/data/truncate_data.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def truncate_order_associations
3737
sql_delete_from "spree_payments #{where_order_id_in_orders_to_delete}"
3838
sql_delete_from "spree_shipments #{where_order_id_in_orders_to_delete}"
3939
sql_delete_from "spree_return_authorizations #{where_order_id_in_orders_to_delete}"
40+
sql_delete_from "proxy_orders #{where_order_id_in_orders_to_delete}"
4041
end
4142

4243
def truncate_subscriptions

0 commit comments

Comments
 (0)