Merge lp:~vthompson/music-app/fix-1511585-part-2 into lp:music-app

Proposed by Victor Thompson
Status: Merged
Approved by: Andrew Hayzen
Approved revision: 936
Merged at revision: 936
Proposed branch: lp:~vthompson/music-app/fix-1511585-part-2
Merge into: lp:music-app
Diff against target: 131 lines (+91/-1)
4 files modified
README.autopilot (+15/-1)
debian/changelog (+2/-0)
tests/autopilot/music_app/content/mediascanner-2.0/mediastore.sch (+71/-0)
tests/autopilot/music_app/content/mediascanner-2.0/mediastore.sql (+3/-0)
To merge this branch: bzr merge lp:~vthompson/music-app/fix-1511585-part-2
Reviewer Review Type Date Requested Status
Andrew Hayzen Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+276483@code.launchpad.net

Commit message

* Update canned mediastore.db schema version from 9 to 10.
* Add directions for updating and debugging schema version changes.

Description of the change

* Update canned mediastore.db schema version from 9 to 10.
* Add directions for updating and debugging schema version changes.

Please follow through the instructions to debug/upgrade against trunk to verify they make sense.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

PASSED: Continuous integration, rev:936
http://91.189.93.70:8080/job/music-app-ci/1413/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/music-app-vivid-amd64-ci/265

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/music-app-ci/1413/rebuild

review: Approve (continuous-integration)
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

$ adt-run . ./com.ubuntu.music_2.2.936_all.click -o /tmp/music-app-output/ --- ssh -s adb -- -p <OMITTED>
autopilot PASS

\o/

Thanks for keeping up with the mediascanner2 schemas fun :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.autopilot'
2--- README.autopilot 2015-07-23 01:47:34 +0000
3+++ README.autopilot 2015-11-03 02:46:37 +0000
4@@ -39,7 +39,6 @@
5 $ autopilot3 launch -i Qt qmlscene app/music-app.qml
6 $ autopilot3 vis
7
8-
9 ## Running tests on device or emulator:
10
11 NOTE: Prior to running the tests on the device, you will need to do the following if there is music on the system:
12@@ -60,3 +59,18 @@
13
14 * Run the tests on device (assumes only one click package in the directory)
15 $ adt-run . *.click --- ssh -s adb -- -p <PASSWORD>
16+
17+# Resolving mediascanner2 schema issues when tests fail
18+
19+Occasionally the schema for the mediascanner2 (ms2) service is incremented and updates to the mocked ms2 database are required. The following steps should be taken to update the database and sql file when this happens.
20+
21+1. Dump a new schema file for the database for debugging:
22+ $ sqlite3 ~/.cache/mediascanner-2.0/mediastore.db .sch > tests/autopilot/music_app/content/mediascanner-2.0/mediastore.sch
23+
24+2. Edit the SQL file to use the new schemaVersion number:
25+ $ vi tests/autopilot/music_app/content/mediascanner-2.0/mediastore.sql
26+
27+3. If the tests still do not pass, execute the following bzr command to debug what has changed in the schema and update the SQL file to insert the values for each column in the 'media' table accordingly:
28+ $ bzr diff tests/autopilot/music_app/content/mediascanner-2.0/mediastore.sch
29+ $ vi tests/autopilot/music_app/content/mediascanner-2.0/mediastore.sql
30+
31
32=== modified file 'debian/changelog'
33--- debian/changelog 2015-11-02 14:59:24 +0000
34+++ debian/changelog 2015-11-03 02:46:37 +0000
35@@ -7,6 +7,8 @@
36 * Remove some deprecated code for the UbuntuShape image property.
37 * Update app to use the Ubuntu Components version 1.3 (LP: #1508363)
38 * Update canned mediastore.db schema version from 8 to 9 (LP: #1511585).
39+ * Update canned mediastore.db schema version from 9 to 10.
40+ * Add directions for updating and debugging schema version changes.
41
42 [ Andrew Hayzen ]
43 * Switch to using the new uc1.3 listitems within the SDK
44
45=== added file 'tests/autopilot/music_app/content/mediascanner-2.0/mediastore.sch'
46--- tests/autopilot/music_app/content/mediascanner-2.0/mediastore.sch 1970-01-01 00:00:00 +0000
47+++ tests/autopilot/music_app/content/mediascanner-2.0/mediastore.sch 2015-11-03 02:46:37 +0000
48@@ -0,0 +1,71 @@
49+CREATE TABLE schemaVersion (version INTEGER);
50+CREATE TABLE media (
51+ id INTEGER PRIMARY KEY,
52+ filename TEXT UNIQUE NOT NULL CHECK (filename LIKE '/%'),
53+ content_type TEXT,
54+ etag TEXT,
55+ title TEXT,
56+ date TEXT,
57+ artist TEXT, -- Only relevant to audio
58+ album TEXT, -- Only relevant to audio
59+ album_artist TEXT, -- Only relevant to audio
60+ genre TEXT, -- Only relevant to audio
61+ disc_number INTEGER, -- Only relevant to audio
62+ track_number INTEGER, -- Only relevant to audio
63+ duration INTEGER,
64+ width INTEGER, -- Only relevant to video/images
65+ height INTEGER, -- Only relevant to video/images
66+ latitude DOUBLE,
67+ longitude DOUBLE,
68+ has_thumbnail INTEGER CHECK (has_thumbnail IN (0, 1)),
69+ mtime INTEGER,
70+ type INTEGER CHECK (type IN (1, 2, 3)) -- MediaType enum
71+);
72+CREATE INDEX media_type_idx ON media(type);
73+CREATE INDEX media_song_info_idx ON media(type, album_artist, album, disc_number, track_number, title) WHERE type = 1;
74+CREATE INDEX media_artist_idx ON media(type, artist) WHERE type = 1;
75+CREATE INDEX media_genre_idx ON media(type, genre) WHERE type = 1;
76+CREATE INDEX media_mtime_idx ON media(type, mtime);
77+CREATE TABLE media_attic (
78+ filename TEXT UNIQUE NOT NULL,
79+ content_type TEXT,
80+ etag TEXT,
81+ title TEXT,
82+ date TEXT,
83+ artist TEXT, -- Only relevant to audio
84+ album TEXT, -- Only relevant to audio
85+ album_artist TEXT, -- Only relevant to audio
86+ genre TEXT, -- Only relevant to audio
87+ disc_number INTEGER, -- Only relevant to audio
88+ track_number INTEGER, -- Only relevant to audio
89+ duration INTEGER,
90+ width INTEGER, -- Only relevant to video/images
91+ height INTEGER, -- Only relevant to video/images
92+ latitude DOUBLE,
93+ longitude DOUBLE,
94+ has_thumbnail INTEGER,
95+ mtime INTEGER,
96+ type INTEGER -- 0=Audio, 1=Video
97+);
98+CREATE VIRTUAL TABLE media_fts
99+USING fts4(content='media', title, artist, album, tokenize=mozporter);
100+CREATE TABLE 'media_fts_segments'(blockid INTEGER PRIMARY KEY, block BLOB);
101+CREATE TABLE 'media_fts_segdir'(level INTEGER,idx INTEGER,start_block INTEGER,leaves_end_block INTEGER,end_block INTEGER,root BLOB,PRIMARY KEY(level, idx));
102+CREATE TABLE 'media_fts_docsize'(docid INTEGER PRIMARY KEY, size BLOB);
103+CREATE TABLE 'media_fts_stat'(id INTEGER PRIMARY KEY, value BLOB);
104+CREATE TRIGGER media_bu BEFORE UPDATE ON media BEGIN
105+ DELETE FROM media_fts WHERE docid=old.id;
106+END;
107+CREATE TRIGGER media_au AFTER UPDATE ON media BEGIN
108+ INSERT INTO media_fts(docid, title, artist, album) VALUES (new.id, new.title, new.artist, new.album);
109+END;
110+CREATE TRIGGER media_bd BEFORE DELETE ON media BEGIN
111+ DELETE FROM media_fts WHERE docid=old.id;
112+END;
113+CREATE TRIGGER media_ai AFTER INSERT ON media BEGIN
114+ INSERT INTO media_fts(docid, title, artist, album) VALUES (new.id, new.title, new.artist, new.album);
115+END;
116+CREATE TABLE broken_files (
117+ filename TEXT PRIMARY KEY NOT NULL,
118+ etag TEXT NOT NULL
119+);
120
121=== modified file 'tests/autopilot/music_app/content/mediascanner-2.0/mediastore.sql'
122--- tests/autopilot/music_app/content/mediascanner-2.0/mediastore.sql 2015-11-01 16:17:33 +0000
123+++ tests/autopilot/music_app/content/mediascanner-2.0/mediastore.sql 2015-11-03 02:46:37 +0000
124@@ -1,4 +1,7 @@
125 BEGIN TRANSACTION;
126+DELETE FROM `schemaVersion`;
127+INSERT INTO `schemaVersion` VALUES(10);
128+
129 DROP TABLE media;
130 CREATE TABLE media (
131 filename TEXT PRIMARY KEY NOT NULL CHECK (filename LIKE '/%'),

Subscribers

People subscribed via source and target branches