User:Clouserw/AMODBrefresh

From MozillaWiki
Jump to: navigation, search

Run this on -dev after you import a fresh db from production. Special thanks to madame Krupa for keeping this list alive in various places. :)

Double check these rules before running. It's a public site!

  UPDATE groups SET rules="*:*" where name="QA" limit 1;
  UPDATE auth_user 
  SET is_superuser=1 
  WHERE id IN (
    SELECT user_id FROM groups_users JOIN groups ON groups.id = groups_users.group_id WHERE groups.name="QA"
  );

  UPDATE `config` 
  SET `value` = 'a:2:{s:3:"msg";s:254:"<strong>This is a PREVIEW server!</strong> Changes here are not saved and will be overwritten with data from production. If you''re localizing your strings and want them to stick around, do it on <a href="https://addons.mozilla.org/localizers/">AMO</a>";s:12:"msg_purified";s:334:"<strong>This is a PREVIEW server!</strong> Changes here are not saved and will be overwritten with data from production. If you''re localizing your strings and want them to stick around, do it on <a href="http://outgoing.stage.mozilla.com/v1/5ae7f4b833c4c84d754d4a365a6814f1bd019924/https%3A//addons.mozilla.org/localizers/">AMO</a>";}' 
  WHERE `config`.`key` = 'l10n_motd' 
  LIMIT 1 ;
  
  update waffle_sample_mkt set percent="100.0" where name='csp-store-reports';
  update waffle_sample_amo set percent="100.0" where name='csp-store-reports';

  insert into api_access (`key`, user_id, secret) values ('mkt:5520425:amckay@mozilla.com', 5520425, 'd6444926578f6dbddf6f434f80e7ff60ef585c010c4333397e159fe727514937aae492ef706f2590bf5fe361d4a4393e6e5125db3cf5388b3e2c359d0f2063fb')

  -- something for robhudson; 2013-10-23
 INSERT INTO api_access (`key`, user_id, secret) VALUES ('9220b06ec2ceb302804f8da59cd4ada9988744646eae8bfd3ce4ba653d718abb1128f806af759200ee181a5e2ab8c561f35170501ba7c6726bbb864679645ec2', 10275024, 'aes:94b8293b293be35165b9a806d41e0b16e3a6141d416050af8213961a1bb328bd|687c6cc489a99fa6de14f99245edc851aee42e668d0c42fb75f6ad406c619365|6a0fe3db0014dc5575e0e5af997f78cde6e9c49d40d065a7d244f1f23693b520d6d2fb5be5bf83350251a145ec592231cc8aae3419fc1c3d27c005ef8e1f9f1a6d965df43c162ca317f820909dd7a3f2e49c8811bc7499d65866dcb03dd920a5c1497f8472ce4434bc5ecaa99451eb6c8edd4a7d3d4045416c725f391003aa9f3ecda6a5fd860a7c6df94c12437c63166017dbdb1337725c575e1ca90ff88d493bdba6c5b47261bc27a271aab230b381e404535d45adc55f728f9c8cf725d6716fe645f00102d48e143d8b0374a76799')


Solitude and payment accounts are in a seperate database, so after a sync, run this to clear out all payment accounts and reset all public paid apps to pending:

set foreign_key_checks = 0;
truncate payments_seller;
truncate payment_accounts;
truncate addon_payment_account;
truncate user_inapp_keys;
     
-- purchases and contributions etc
truncate addon_purchase;
truncate stats_contributions;
set foreign_key_checks = 1;

-- find all public webapps that might have payments and make them unreviewed
update addons set status = 1  where addontype_id = 11 and premium_type in (1, 2, 3,4) and status in (4, 13);

We then need to truncate all the tables in solitude on stage or dev, or drop and recreate it.

DATABASE='solitudedb'; echo mysql -Nse 'show tables' $DATABASE | grep -v schema_version | while read table; do mysql -e "set foreign_key_checks = 0; truncate table $table;  set foreign_key_checks = 1;" $DATABASE ; done'

We then need to make some price tiers for the reference provider (zippy). A simple way to do this is to move all Bango price tiers over to the reference provider:

UPDATE price_currency SET provider = 2;

<p> Since deleting payment accounts will de-list apps, the search index needs to be updated to reflect this

./manage.py --settings=settings_local_mkt reindex_mkt