1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
|
<?xml version="1.0" encoding="utf-8"?>
<!--
This is the Mixxx schema history file. It keeps track of internal changes to the
Mixxx database schema and allows Mixxx to automatically upgrade itself to new
revisions of the schema on a version upgrade.
DO NOT EDIT THIS FILE OR YOU WILL BREAK YOUR MIXXX LIBRARY AND LOSE YOUR
METADATA
-->
<schema>
<revision version="1">
<description>
The base schema for the Mixxx SQLITE database.
</description>
<sql>
CREATE TABLE IF NOT EXISTS settings (
name TEXT UNIQUE NOT NULL,
value TEXT,
locked INTEGER DEFAULT 0,
hidden INTEGER DEFAULT 0);
CREATE TABLE IF NOT EXISTS track_locations (
id INTEGER PRIMARY KEY AUTOINCREMENT,
location varchar(512) UNIQUE,
filename varchar(512),
directory varchar(512),
filesize INTEGER,
fs_deleted INTEGER,
needs_verification INTEGER);
CREATE TABLE IF NOT EXISTS LibraryHashes (
directory_path VARCHAR(256) primary key,
hash INTEGER,
directory_deleted INTEGER);
CREATE TABLE IF NOT EXISTS library (
id INTEGER primary key AUTOINCREMENT,
artist varchar(48), title varchar(48),
album varchar(48), year varchar(16),
genre varchar(32), tracknumber varchar(3),
location varchar(512) REFERENCES track_locations(location),
comment varchar(20), url varchar(256),
duration float,
bitrate integer, samplerate integer,
cuepoint integer, bpm float,
wavesummaryhex blob,
channels integer,
datetime_added DEFAULT CURRENT_TIMESTAMP,
mixxx_deleted integer,
played integer);
CREATE TABLE Playlists (
id INTEGER primary key,
name varchar(48),
position INTEGER,
hidden INTEGER DEFAULT 0 NOT NULL,
date_created datetime,
date_modified datetime);
CREATE TABLE PlaylistTracks (
id INTEGER primary key,
playlist_id INTEGER REFERENCES Playlists(id),
track_id INTEGER REFERENCES library(id),
position INTEGER);
CREATE TABLE IF NOT EXISTS cues (
id integer PRIMARY KEY AUTOINCREMENT,
track_id integer NOT NULL REFERENCES library(id),
type integer DEFAULT 0 NOT NULL,
position integer DEFAULT -1 NOT NULL,
length integer DEFAULT 0 NOT NULL,
hotcue integer DEFAULT -1 NOT NULL,
label text DEFAULT '' NOT NULL);
CREATE TABLE IF NOT EXISTS crates (
id integer PRIMARY KEY AUTOINCREMENT,
name varchar(48) UNIQUE NOT NULL,
count integer DEFAULT 0,
show integer DEFAULT 1);
CREATE TABLE IF NOT EXISTS crate_tracks (
crate_id integer NOT NULL REFERENCES crates(id),
track_id integer NOT NULL REFERENCES library(id),
UNIQUE (crate_id, track_id));
</sql>
</revision>
<revision version="2">
<description>
Add a header_parsed integer column to the library to indicate when a
track's tags have been parsed.
</description>
<sql>
ALTER TABLE library ADD COLUMN header_parsed integer DEFAULT 0;
</sql>
</revision>
<revision version="3">
<description>
Change the location column to be a an integer. Change comment to be
varchar(256) and album/artist/title to be varchar(64).
</description>
<sql>
ALTER TABLE library RENAME TO library_old;
CREATE TABLE IF NOT EXISTS library (
id INTEGER primary key AUTOINCREMENT,
artist varchar(64),
title varchar(64),
album varchar(64),
year varchar(16),
genre varchar(64),
tracknumber varchar(3),
location integer REFERENCES track_locations(location),
comment varchar(256),
url varchar(256),
duration float,
bitrate integer,
samplerate integer,
cuepoint integer,
bpm float,
wavesummaryhex blob,
channels integer,
datetime_added DEFAULT CURRENT_TIMESTAMP,
mixxx_deleted integer,
played integer,
header_parsed integer DEFAULT 0);
INSERT INTO library (id, artist, title, album, year, genre, tracknumber, location, comment, url, duration, bitrate, samplerate, bpm, cuepoint, bpm, wavesummaryhex, channels, datetime_added, mixxx_deleted, played, header_parsed) SELECT id, artist, title, album, year, genre, tracknumber, location, comment, url, duration, bitrate, samplerate, bpm, cuepoint, bpm, wavesummaryhex, channels, datetime_added, mixxx_deleted, played, header_parsed from library_old;
DROP TABLE library_old;
</sql>
</revision>
<revision version="4">
<description>
Add file type column.
</description>
<sql>
ALTER TABLE library ADD COLUMN filetype varchar(8) DEFAULT "?";
</sql>
</revision>
<revision version="5">
<description>
Add needs_verification column to library hashes table.
</description>
<sql>
ALTER TABLE LibraryHashes ADD COLUMN needs_verification INTEGER DEFAULT 0;
</sql>
</revision>
<revision version="6">
<description>
Added a ReplayGain Column.
</description>
<sql>
ALTER TABLE library ADD COLUMN replaygain float DEFAULT 0;
</sql>
</revision>
<revision version="7" min_compatible="3">
<description>
Add timesplayed and rating column. Reset header state.
</description>
<sql>
ALTER TABLE library ADD COLUMN timesplayed integer DEFAULT 0;
ALTER TABLE library ADD COLUMN rating integer DEFAULT 0;
ALTER TABLE library ADD COLUMN key varchar(8) DEFAULT "";
UPDATE library SET timesplayed = played;
UPDATE library SET played = 0;
DELETE FROM settings WHERE name="mixxx.db.model.library.header_state";
DELETE FROM settings WHERE name="mixxx.db.model.playlist.header_state";
DELETE FROM settings WHERE name="mixxx.db.model.crate.header_state";
DELETE FROM settings WHERE name="mixxx.db.model.prepare.header_state";
DELETE FROM settings WHERE name="mixxx.db.model.missing.header_state";
</sql>
</revision>
<revision version="8" min_compatible="3">
<description>
Added iTunes tables
</description>
<sql>
CREATE TABLE IF NOT EXISTS itunes_library (
id INTEGER primary key,
artist varchar(48), title varchar(48),
album varchar(48), year varchar(16),
genre varchar(32), tracknumber varchar(3),
location varchar(512),
comment varchar(60),
duration integer,
bitrate integer,
bpm integer,
rating integer);
CREATE TABLE IF NOT EXISTS itunes_playlists (
id INTEGER primary key,
name varchar(100) UNIQUE);
CREATE TABLE IF NOT EXISTS itunes_playlist_tracks (
id INTEGER primary key AUTOINCREMENT,
playlist_id INTEGER REFERENCES itunes_playlist(id),
track_id INTEGER REFERENCES itunes_library(id));
</sql>
</revision>
<revision version="9" min_compatible="3">
<description>
Tables for Traktor library feature
</description>
<sql>
CREATE TABLE IF NOT EXISTS traktor_library (
id INTEGER primary key AUTOINCREMENT,
artist varchar(48), title varchar(48),
album varchar(48), year varchar(16),
genre varchar(32), tracknumber varchar(3),
location varchar(512) UNIQUE,
comment varchar(60),
duration integer,
bitrate integer,
bpm float,
key varchar(6),
rating integer
);
CREATE TABLE IF NOT EXISTS traktor_playlists (
id INTEGER primary key,
name varchar(100) UNIQUE
);
CREATE TABLE IF NOT EXISTS traktor_playlist_tracks (
id INTEGER primary key AUTOINCREMENT,
playlist_id INTEGER REFERENCES traktor_playlist(id),
track_id INTEGER REFERENCES traktor_library(id)
);
</sql>
</revision>
<revision version="10" min_compatible="3">
<description>
Playlist and crate locks
</description>
<sql>
ALTER TABLE crates ADD COLUMN locked integer DEFAULT 0;
ALTER TABLE playlists ADD COLUMN locked integer DEFAULT 0;
</sql>
</revision>
<revision version="11" min_compatible="3">
<description>
Tables for Rhythmbox library feature
</description>
<sql>
CREATE TABLE IF NOT EXISTS rhythmbox_library (
id INTEGER primary key AUTOINCREMENT,
artist varchar(48), title varchar(48),
album varchar(48), year varchar(16),
genre varchar(32), tracknumber varchar(3),
location varchar(512) UNIQUE,
comment varchar(60),
duration integer,
bitrate integer,
bpm float,
key varchar(6),
rating integer
);
CREATE TABLE IF NOT EXISTS rhythmbox_playlists (
id INTEGER primary key AUTOINCREMENT,
name varchar(100) UNIQUE
);
CREATE TABLE IF NOT EXISTS rhythmbox_playlist_tracks (
id INTEGER primary key AUTOINCREMENT,
playlist_id INTEGER REFERENCES rhythmbox_playlist(id),
track_id INTEGER REFERENCES rhythmbox_library(id)
);
</sql>
</revision>
<revision version="12" min_compatible="3">
<description>
Add beats column to library table.
</description>
<sql>
ALTER TABLE Library ADD COLUMN beats BLOB;
ALTER TABLE Library ADD COLUMN beats_version TEXT;
</sql>
</revision>
<revision version="13" min_compatible="3">
<description>
Add position column to Rhythmbox, iTunes, and Traktor playlist tables.
</description>
<sql>
ALTER TABLE itunes_playlist_tracks ADD COLUMN position INTEGER DEFAULT 0;
ALTER TABLE rhythmbox_playlist_tracks ADD COLUMN position INTEGER DEFAULT 0;
ALTER TABLE traktor_playlist_tracks ADD COLUMN position INTEGER DEFAULT 0;
</sql>
</revision>
<revision version="14" min_compatible="3">
<description>
Add composer column to library table.
</description>
<sql>
ALTER TABLE library ADD COLUMN composer varchar(64) DEFAULT "";
</sql>
</revision>
<revision version="15" min_compatible="3">
<description>
Add datetime_added to playlists tracks.
</description>
<sql>
ALTER TABLE PlaylistTracks ADD COLUMN pl_datetime_added;
</sql>
</revision>
<revision version="16" min_compatible="3">
<description>
Add track analysis table.
</description>
<sql>
CREATE TABLE IF NOT EXISTS track_analysis (
id INTEGER primary key AUTOINCREMENT,
track_id INTEGER NOT NULL REFERENCES track_locations(id),
type varchar(512),
description varchar(1024),
version varchar(512),
created DEFAULT CURRENT_TIMESTAMP,
data_checksum varchar(512)
);
UPDATE library SET wavesummaryhex = '';
CREATE INDEX IF NOT EXISTS track_analysis_track_id_index ON <
|