Skip to content

Instantly share code, notes, and snippets.

@preetamtt
Created December 5, 2016 21:31
Show Gist options
  • Save preetamtt/ba38f52dc4ec853676c552848fbbdd44 to your computer and use it in GitHub Desktop.
Save preetamtt/ba38f52dc4ec853676c552848fbbdd44 to your computer and use it in GitHub Desktop.
1 Price columns:
preetam@farnsworth-preetam:~$ sudo -u www-data php /srv/thumbtack/current/bin/maintenance/monetization/update_base_prices.php --csv-path ~/test_cc.csv
Dec 05 20:38:34 [info] Found 2 categories to update.
Dec 05 20:38:34 [info] Found 1 price columns to update. Columns = rca_price_cc
Dec 05 20:38:34 [info] Backing up existing prices to /tmp/tmpp7KNXi3u/price-backup-rca_price_cc-1480970314
Dec 05 20:38:34 [info] Updating record 1: Category ID: 1, column name: rca_price_cc original price: 8,
new price: 8
Dec 05 20:38:34 [info] Updating record 2: Category ID: 2, column name: rca_price_cc original price: 4,
new price: 4
Dec 05 20:38:34 [info] Backed up to /tmp/tmpp7KNXi3u/price-backup-rca_price_cc-1480970314
Dec 05 20:38:34 [info] Done!
2 Price columns:
preetam@farnsworth-preetam:~$ sudo -u www-data php /srv/thumbtack/current/bin/maintenance/monetization/update_base_prices.php --csv-path ~/test_cc_iq.csv
Dec 05 20:47:05 [info] Found 2 categories to update.
Dec 05 20:47:05 [info] Found 2 price column(s) to update. Columns = rca_price_iq,rca_price_cc
Dec 05 20:47:05 [info] Backing up existing prices to /tmp/tmpKLrpMlxQ/base-price-backup-rca_price_iq-rca_price_cc-1480970825
Dec 05 20:47:05 [info] Updating record 1: Category ID: 1, column name: rca_price_iq original price: 7,
new price: 7
Dec 05 20:47:05 [info] Updating record 1: Category ID: 1, column name: rca_price_cc original price: 8,
new price: 8
Dec 05 20:47:05 [info] Updating record 2: Category ID: 2, column name: rca_price_iq original price: 4,
new price: 4
Dec 05 20:47:05 [info] Updating record 2: Category ID: 2, column name: rca_price_cc original price: 4,
new price: 4
Dec 05 20:47:05 [info] Backed up to /tmp/tmpKLrpMlxQ/base-price-backup-rca_price_iq-rca_price_cc-1480970825
Dec 05 20:47:05 [info] Done!
3 Price columns:
preetam@farnsworth-preetam:~$ sudo -u www-data php /srv/thumbtack/current/bin/maintenance/monetization/update_base_prices.php --csv-path ~/test_all.csv
Dec 05 20:38:58 [info] Found 2 categories to update.
Dec 05 20:38:58 [info] Found 3 price column(s) to update. Columns = rca_price_iq,rca_price_cc,rca_credit_price
Dec 05 20:38:58 [info] Backing up existing prices to /tmp/tmp8dyUcB_V/price-backup-rca_price_iq-rca_price_cc-rca_credit_price-1480970338
Dec 05 20:38:58 [info] Updating record 1: Category ID: 1, column name: rca_price_iq original price: 7,
new price: 7
Dec 05 20:38:58 [info] Updating record 1: Category ID: 1, column name: rca_price_cc original price: 8,
new price: 8
Dec 05 20:38:58 [info] Updating record 1: Category ID: 1, column name: rca_credit_price original price: 2,
new price: 2
Dec 05 20:38:58 [info] Updating record 2: Category ID: 2, column name: rca_price_iq original price: 4,
new price: 4
Dec 05 20:38:58 [info] Updating record 2: Category ID: 2, column name: rca_price_cc original price: 4,
new price: 4
Dec 05 20:38:58 [info] Updating record 2: Category ID: 2, column name: rca_credit_price original price: 1,
new price: 1
Dec 05 20:38:58 [info] Backed up to /tmp/tmp8dyUcB_V/price-backup-rca_price_iq-rca_price_cc-rca_credit_price-1480970338
Dec 05 20:38:58 [info] Done!
preetam@farnsworth-preetam:~$ sudo cat /tmp/tmp8dyUcB_V/price-backup-rca_price_iq-rca_price_cc-rca_credit_price-1480970338
rca_request_category_id,rca_price_iq,rca_price_cc,rca_credit_price
1,7,8,2
2,4,4,1
Update query:
preetam@farnsworth-preetam:~$ sudo -u www-data php /srv/thumbtack/current/bin/maintenance/monetization/update_base_prices.php --csv-path ~/test_cc_iq.csv
Dec 05 20:51:01 [info] Found 2 categories to update.
Dec 05 20:51:01 [info] Found 2 price column(s) to update. Columns = rca_price_iq,rca_price_cc
Dec 05 20:51:01 [info] Backing up existing prices to /tmp/tmpN_uFvcbu/base-price-backup-rca_price_iq-rca_price_cc-1480971061
Dec 05 20:51:01 [info] UPDATE query: UPDATE rca_request_categories SET rca_price_iq = :target_price_iq,rca_price_cc = :target_price_cc WHERE rca_request_category_id = :category_id
Update via backup:
sudo -u www-data php /srv/thumbtack/current/bin/maintenance/monetization/update_base_prices.php --csv-path /tmp/tmpcWkGFejy/base-price-backup-rca_price_iq-rca_price_cc-1480971094
Dec 05 20:53:13 [info] Found 2 categories to update.
Dec 05 20:53:13 [info] Found 2 price column(s) to update. Columns = rca_price_iq,rca_price_cc
Dec 05 20:53:13 [info] Backing up existing prices to /tmp/tmpSRRbihWW/base-price-backup-rca_price_iq-rca_price_cc-1480971193
Dec 05 20:53:13 [info] Updating record 1: Category ID: 1, column name: rca_price_iq original price: 7,
new price: 7
Dec 05 20:53:13 [info] Updating record 1: Category ID: 1, column name: rca_price_cc original price: 8,
new price: 8
Dec 05 20:53:13 [info] Updating record 2: Category ID: 2, column name: rca_price_iq original price: 4,
new price: 4
Dec 05 20:53:13 [info] Updating record 2: Category ID: 2, column name: rca_price_cc original price: 4,
new price: 4
Dec 05 20:53:13 [info] Backed up to /tmp/tmpSRRbihWW/base-price-backup-rca_price_iq-rca_price_cc-1480971193
Dec 05 20:53:13 [info] Done!
Tested against current CSV in git:
sudo -u www-data php /srv/thumbtack/current/bin/maintenance/monetization/update_base_prices.php --csv-path /srv/thumbtack/current/bin/maintenance/monetization/cc_price_update_20161031.csv
Dec 05 20:55:02 [info] Found 1053 categories to update.
Dec 05 20:55:02 [info] Found 1 price column(s) to update. Columns = rca_price_cc
...
Dec 05 20:55:16 [info] Updating record 1053: Category ID: 1675, column name: rca_price_cc original price: 7,
new price: 7
Dec 05 20:55:16 [info] Backed up to /tmp/tmplLgDB6xy/base-price-backup-rca_price_cc-1480971302
Dec 05 20:55:16 [info] Done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment