mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-18 20:34:39 +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
|
/* Schema should be kept identical to the "songs" table, even though most of
|
||||||
attached external database and created by jamendo.sql */
|
it isn't used by jamendo */
|
||||||
SELECT 0;
|
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
|
// Attach external databases
|
||||||
foreach (const QString& key, attached_databases_.keys()) {
|
foreach (const QString& key, attached_databases_.keys()) {
|
||||||
const QString filename = attached_databases_[key].filename_;
|
const QString filename = attached_databases_[key].filename_;
|
||||||
const bool already_exists = QFile::exists(filename);
|
|
||||||
|
|
||||||
// Attach the db
|
// Attach the db
|
||||||
QSqlQuery q("ATTACH DATABASE :filename AS :alias", db);
|
QSqlQuery q("ATTACH DATABASE :filename AS :alias", db);
|
||||||
@ -420,11 +419,6 @@ QSqlDatabase Database::Connect() {
|
|||||||
if (!q.exec()) {
|
if (!q.exec()) {
|
||||||
qFatal("Couldn't attach external database '%s'", key.toAscii().constData());
|
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
|
// Get the database's schema version
|
||||||
|
Loading…
Reference in New Issue
Block a user