1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2025-01-28 16:20:26 +01:00

Fix DB schema

This commit is contained in:
Jonas Kvinge 2018-08-15 01:28:37 +02:00
parent 41b0b1efd4
commit 3b30e66e87
2 changed files with 9 additions and 5 deletions

View File

@ -1,8 +1,10 @@
CREATE TABLE IF NOT EXISTS schema_version (
version INTEGER NOT NULL
);
DELETE FROM schema_version;
REPLACE INTO schema_version (version) VALUES (1);
INSERT INTO schema_version (version) VALUES (1);
CREATE TABLE IF NOT EXISTS directories (
path TEXT NOT NULL,

View File

@ -439,9 +439,11 @@ void Database::UpdateDatabaseSchema(int version, QSqlDatabase &db) {
QString filename;
if (version == 0) filename = ":/schema/schema.sql";
else filename = QString(":/schema/schema-%1.sql").arg(version);
else {
filename = QString(":/schema/schema-%1.sql").arg(version);
qLog(Debug) << "Applying database schema update" << version << "from" << filename;
}
ExecSchemaCommandsFromFile(db, filename, version - 1);
}