From 95556df6aa79d88f8678982a8201ca9e2e9b156c Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sun, 17 Oct 2010 11:22:34 +0000 Subject: [PATCH] Move database schema into a subdirectory of data/ --- data/data.qrc | 38 +++++++++++++-------------- data/{ => schema}/schema-1.sql | 0 data/{ => schema}/schema-10.sql | 0 data/{ => schema}/schema-11.sql | 0 data/{ => schema}/schema-12.sql | 0 data/{ => schema}/schema-13.sql | 0 data/{ => schema}/schema-14.sql | 0 data/{ => schema}/schema-15.sql | 0 data/{ => schema}/schema-16.sql | 0 data/{ => schema}/schema-17.sql | 0 data/{ => schema}/schema-2.sql | 0 data/{ => schema}/schema-3.sql | 0 data/{ => schema}/schema-4.sql | 0 data/{ => schema}/schema-5.sql | 0 data/{ => schema}/schema-6.sql | 0 data/{ => schema}/schema-7.sql | 0 data/{ => schema}/schema-8.sql | 0 data/{ => schema}/schema-9.sql | 0 data/{ => schema}/schema.sql | 0 src/core/database.cpp | 4 +-- src/devices/devicedatabasebackend.cpp | 2 +- 21 files changed, 22 insertions(+), 22 deletions(-) rename data/{ => schema}/schema-1.sql (100%) rename data/{ => schema}/schema-10.sql (100%) rename data/{ => schema}/schema-11.sql (100%) rename data/{ => schema}/schema-12.sql (100%) rename data/{ => schema}/schema-13.sql (100%) rename data/{ => schema}/schema-14.sql (100%) rename data/{ => schema}/schema-15.sql (100%) rename data/{ => schema}/schema-16.sql (100%) rename data/{ => schema}/schema-17.sql (100%) rename data/{ => schema}/schema-2.sql (100%) rename data/{ => schema}/schema-3.sql (100%) rename data/{ => schema}/schema-4.sql (100%) rename data/{ => schema}/schema-5.sql (100%) rename data/{ => schema}/schema-6.sql (100%) rename data/{ => schema}/schema-7.sql (100%) rename data/{ => schema}/schema-8.sql (100%) rename data/{ => schema}/schema-9.sql (100%) rename data/{ => schema}/schema.sql (100%) diff --git a/data/data.qrc b/data/data.qrc index 8f65f7ea8..b687bd2bd 100644 --- a/data/data.qrc +++ b/data/data.qrc @@ -2,7 +2,7 @@ mainwindow.css songinfo.css - schema.sql + schema/schema.sql volumeslider-handle_glow.png volumeslider-handle.png volumeslider-inset.png @@ -33,21 +33,21 @@ last.fm/my_neighbours.png last.fm/user_purple.png providers/somafm.png - schema-1.sql - schema-2.sql + schema/schema-1.sql + schema/schema-2.sql nocover.png - schema-3.sql - schema-4.sql - schema-5.sql + schema/schema-3.sql + schema/schema-4.sql + schema/schema-5.sql osd_shadow_corner.png osd_shadow_edge.png - schema-6.sql - schema-7.sql + schema/schema-6.sql + schema/schema-7.sql tiny-pause.png tiny-start.png providers/magnatune.png - schema-8.sql - schema-9.sql + schema/schema-8.sql + schema/schema-9.sql icons/22x22/application-exit.png icons/22x22/applications-internet.png icons/22x22/configure.png @@ -176,21 +176,21 @@ icons/22x22/document-new.png icons/32x32/document-new.png icons/48x48/document-new.png - schema-10.sql - schema-11.sql + schema/schema-10.sql + schema/schema-11.sql osd_background.png icons/22x22/view-fullscreen.png icons/32x32/view-fullscreen.png icons/48x48/view-fullscreen.png - schema-12.sql - schema-13.sql + schema/schema-12.sql + schema/schema-13.sql icons/22x22/input-keyboard.png icons/32x32/input-keyboard.png icons/48x48/input-keyboard.png icons/22x22/edit-delete.png icons/32x32/edit-delete.png icons/48x48/edit-delete.png - schema-14.sql + schema/schema-14.sql icons/22x22/multimedia-player-ipod-mini-blue.png icons/22x22/multimedia-player-ipod-mini-gold.png icons/22x22/multimedia-player-ipod-mini-green.png @@ -248,14 +248,14 @@ icons/22x22/drive-removable-media-usb-pendrive.png icons/32x32/drive-removable-media-usb-pendrive.png icons/48x48/drive-removable-media-usb-pendrive.png - schema-15.sql - device-schema.sql + schema/schema-15.sql + schema/device-schema.sql icons/22x22/go-down.png icons/32x32/go-down.png icons/48x48/go-down.png hypnotoad.gif blank.ttf - schema-16.sql + schema/schema-16.sql icons/22x22/media-eject.png icons/32x32/media-eject.png icons/48x48/media-eject.png @@ -263,7 +263,7 @@ icons/32x32/ipodtouchicon.png icons/48x48/ipodtouchicon.png icons/32x32/wiimotedev.png - schema-17.sql + schema/schema-17.sql lyrics/ultimate_providers.xml sidebar_background.png providers/wikipedia.png diff --git a/data/schema-1.sql b/data/schema/schema-1.sql similarity index 100% rename from data/schema-1.sql rename to data/schema/schema-1.sql diff --git a/data/schema-10.sql b/data/schema/schema-10.sql similarity index 100% rename from data/schema-10.sql rename to data/schema/schema-10.sql diff --git a/data/schema-11.sql b/data/schema/schema-11.sql similarity index 100% rename from data/schema-11.sql rename to data/schema/schema-11.sql diff --git a/data/schema-12.sql b/data/schema/schema-12.sql similarity index 100% rename from data/schema-12.sql rename to data/schema/schema-12.sql diff --git a/data/schema-13.sql b/data/schema/schema-13.sql similarity index 100% rename from data/schema-13.sql rename to data/schema/schema-13.sql diff --git a/data/schema-14.sql b/data/schema/schema-14.sql similarity index 100% rename from data/schema-14.sql rename to data/schema/schema-14.sql diff --git a/data/schema-15.sql b/data/schema/schema-15.sql similarity index 100% rename from data/schema-15.sql rename to data/schema/schema-15.sql diff --git a/data/schema-16.sql b/data/schema/schema-16.sql similarity index 100% rename from data/schema-16.sql rename to data/schema/schema-16.sql diff --git a/data/schema-17.sql b/data/schema/schema-17.sql similarity index 100% rename from data/schema-17.sql rename to data/schema/schema-17.sql diff --git a/data/schema-2.sql b/data/schema/schema-2.sql similarity index 100% rename from data/schema-2.sql rename to data/schema/schema-2.sql diff --git a/data/schema-3.sql b/data/schema/schema-3.sql similarity index 100% rename from data/schema-3.sql rename to data/schema/schema-3.sql diff --git a/data/schema-4.sql b/data/schema/schema-4.sql similarity index 100% rename from data/schema-4.sql rename to data/schema/schema-4.sql diff --git a/data/schema-5.sql b/data/schema/schema-5.sql similarity index 100% rename from data/schema-5.sql rename to data/schema/schema-5.sql diff --git a/data/schema-6.sql b/data/schema/schema-6.sql similarity index 100% rename from data/schema-6.sql rename to data/schema/schema-6.sql diff --git a/data/schema-7.sql b/data/schema/schema-7.sql similarity index 100% rename from data/schema-7.sql rename to data/schema/schema-7.sql diff --git a/data/schema-8.sql b/data/schema/schema-8.sql similarity index 100% rename from data/schema-8.sql rename to data/schema/schema-8.sql diff --git a/data/schema-9.sql b/data/schema/schema-9.sql similarity index 100% rename from data/schema-9.sql rename to data/schema/schema-9.sql diff --git a/data/schema.sql b/data/schema/schema.sql similarity index 100% rename from data/schema.sql rename to data/schema/schema.sql diff --git a/src/core/database.cpp b/src/core/database.cpp index fe9b223b8..3d80929b6 100644 --- a/src/core/database.cpp +++ b/src/core/database.cpp @@ -426,9 +426,9 @@ QSqlDatabase Database::Connect() { void Database::UpdateDatabaseSchema(int version, QSqlDatabase &db) { QString filename; if (version == 0) - filename = ":/schema.sql"; + filename = ":/schema/schema.sql"; else - filename = QString(":/schema-%1.sql").arg(version); + filename = QString(":/schema/schema-%1.sql").arg(version); ScopedTransaction t(&db); ExecFromFile(filename, db); diff --git a/src/devices/devicedatabasebackend.cpp b/src/devices/devicedatabasebackend.cpp index de401d831..6a35f1fa1 100644 --- a/src/devices/devicedatabasebackend.cpp +++ b/src/devices/devicedatabasebackend.cpp @@ -82,7 +82,7 @@ int DeviceDatabaseBackend::AddDevice(const Device& device) { int id = q.lastInsertId().toInt(); // Create the songs tables for the device - QString filename(":device-schema.sql"); + QString filename(":schema/device-schema.sql"); QFile schema_file(filename); if (!schema_file.open(QIODevice::ReadOnly)) qFatal("Couldn't open schema file %s", filename.toUtf8().constData());