Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 57 lines (28 sloc) 2.082 kb
b7404aa Fix for not-recognized 'Vietman'
oliver authored
1 /* Script to update apps.db from schema version 5 to 6 */
2
3 begin exclusive transaction;
4
5 /* Fix incorrect long name */
6
7 update country set name = 'Vietnam' where iso2 = 'VN';
8
dee5f5a correct language for China
oliver authored
9 /* Fix incorrect language code for China */
10
11 update country set language = 'zh-CN' where iso2 = 'CN';
12
a8e733c remove reports without dates
oliver authored
13
14 /* Remove reports without dates */
15
16 delete from sale where report_id in (select id from report where from_date is null or until_date is null);
17
18 delete from report where from_date is null or until_date is null;
19
26bb1c6 Implemented IAP in DB and Reports
oliver authored
20 /* Add table for IAP */
21
22 CREATE TABLE IF NOT EXISTS InAppPurchase ('id' INTEGER PRIMARY KEY, 'title' VARCHAR, 'vendor_identifier' VARCHAR, company_name VARCHAR, parent INTEGER);
23
24 /* move existing IAP */
25
26 replace into InAppPurchase (id, title, vendor_identifier, company_name) select id, title, vendor_identifier, company_name from app where id in (select distinct app_id from sale where type_id = 101);
d19ab87 whitespace after parent identifier column name would prevent proper attr...
oliver authored
27 delete from app where id in (select id from InAppPurchase);
26bb1c6 Implemented IAP in DB and Reports
oliver authored
28 delete from AppAppGrouping where app_id in (select id from InAppPurchase );
a8e733c remove reports without dates
oliver authored
29
30
9cbba16 Rewrote Totalling to cache and replaced averaging
oliver authored
31 /* Create Sum table per app/IAP total */
32
33 CREATE TABLE IF NOT EXISTS ProductTotals (product_id INTEGER, currency char(3), sum_units INTEGER, sum_royalties REAL, PRIMARY KEY (product_id, currency));
34
35
240c843 deferred loading of report categories not necessary at the moment
oliver authored
36 /* Move app grouping from own table to report table */
9cbba16 Rewrote Totalling to cache and replaced averaging
oliver authored
37
240c843 deferred loading of report categories not necessary at the moment
oliver authored
38 DROP TABLE IF EXISTS tmp_report;
9cbba16 Rewrote Totalling to cache and replaced averaging
oliver authored
39
240c843 deferred loading of report categories not necessary at the moment
oliver authored
40 CREATE TABLE tmp_report as select id, report_type_id, report_region_id, from_date, until_date, downloaded_date from report;
41
42 DROP TABLE report;
43
44 CREATE TABLE report (id INTEGER PRIMARY KEY, report_type_id INTEGER, report_region_id INTEGER, from_date DATE, until_date DATE, downloaded_date DATE, appgrouping_id INTEGER);
45
46 INSERT INTO report (id, report_type_id, report_region_id, from_date, until_date, downloaded_date, appgrouping_id) select id, report_type_id, report_region_id, from_date, until_date, downloaded_date, reportappgrouping.appgrouping_id from tmp_report left join reportappgrouping on tmp_report.id = report_id;
47
48 DROP TABLE tmp_report;
49
50 DROP TABLE ReportAppGrouping;
9cbba16 Rewrote Totalling to cache and replaced averaging
oliver authored
51
b7404aa Fix for not-recognized 'Vietman'
oliver authored
52 /* update schema_version */
53
d19ab87 whitespace after parent identifier column name would prevent proper attr...
oliver authored
54 update meta set schema_version = 6;
240c843 deferred loading of report categories not necessary at the moment
oliver authored
55
b7404aa Fix for not-recognized 'Vietman'
oliver authored
56
57 commit;
Something went wrong with that request. Please try again.