mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-18 04:19:55 +01:00
Treat the Jamendo database schema the same as other databases.
This commit is contained in:
parent
987dd8c57a
commit
f9959a4fba
@ -1,4 +1,54 @@
|
||||
/* This file used to contain Jamendo schema, but it is now included in an
|
||||
attached external database and created by jamendo.sql */
|
||||
SELECT 0;
|
||||
/* Schema should be kept identical to the "songs" table, even though most of
|
||||
it isn't used by jamendo */
|
||||
CREATE TABLE jamendo.songs (
|
||||
title TEXT,
|
||||
album TEXT,
|
||||
artist TEXT,
|
||||
albumartist TEXT,
|
||||
composer TEXT,
|
||||
track INTEGER,
|
||||
disc INTEGER,
|
||||
bpm REAL,
|
||||
year INTEGER,
|
||||
genre TEXT,
|
||||
comment TEXT,
|
||||
compilation INTEGER,
|
||||
|
||||
length INTEGER,
|
||||
bitrate INTEGER,
|
||||
samplerate INTEGER,
|
||||
|
||||
directory INTEGER NOT NULL,
|
||||
filename TEXT NOT NULL,
|
||||
mtime INTEGER NOT NULL,
|
||||
ctime INTEGER NOT NULL,
|
||||
filesize INTEGER NOT NULL,
|
||||
|
||||
sampler INTEGER NOT NULL DEFAULT 0,
|
||||
art_automatic TEXT,
|
||||
art_manual TEXT,
|
||||
filetype INTEGER NOT NULL DEFAULT 0,
|
||||
playcount INTEGER NOT NULL DEFAULT 0,
|
||||
lastplayed INTEGER,
|
||||
rating INTEGER,
|
||||
forced_compilation_on INTEGER NOT NULL DEFAULT 0,
|
||||
forced_compilation_off INTEGER NOT NULL DEFAULT 0,
|
||||
effective_compilation NOT NULL DEFAULT 0,
|
||||
skipcount NOT NULL DEFAULT 0,
|
||||
score NOT NULL DEFAULT 0
|
||||
);
|
||||
|
||||
CREATE VIRTUAL TABLE jamendo.songs_fts USING fts3(
|
||||
ftstitle, ftsalbum, ftsartist, ftsalbumartist, ftscomposer, ftsgenre, ftscomment,
|
||||
tokenize=unicode
|
||||
);
|
||||
|
||||
CREATE INDEX jamendo.idx_jamendo_comp_artist ON songs (effective_compilation, artist);
|
||||
|
||||
CREATE TABLE jamendo.track_ids (
|
||||
songs_row_id INTEGER PRIMARY KEY,
|
||||
track_id INTEGER
|
||||
);
|
||||
|
||||
CREATE INDEX jamendo.idx_jamendo_track_id ON track_ids(track_id);
|
||||
|
||||
|
@ -411,7 +411,6 @@ QSqlDatabase Database::Connect() {
|
||||
// Attach external databases
|
||||
foreach (const QString& key, attached_databases_.keys()) {
|
||||
const QString filename = attached_databases_[key].filename_;
|
||||
const bool already_exists = QFile::exists(filename);
|
||||
|
||||
// Attach the db
|
||||
QSqlQuery q("ATTACH DATABASE :filename AS :alias", db);
|
||||
@ -420,11 +419,6 @@ QSqlDatabase Database::Connect() {
|
||||
if (!q.exec()) {
|
||||
qFatal("Couldn't attach external database '%s'", key.toAscii().constData());
|
||||
}
|
||||
|
||||
// Set up initial schema if it didn't exist already
|
||||
if (!already_exists) {
|
||||
ExecFromFile(attached_databases_[key].schema_, db);
|
||||
}
|
||||
}
|
||||
|
||||
// Get the database's schema version
|
||||
|
Loading…
Reference in New Issue
Block a user