[rygel] media-export: Yet another database version
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] media-export: Yet another database version
- Date: Sat, 24 Jul 2010 00:55:50 +0000 (UTC)
commit 528717d40b73bf7da2098f0ebdbb1f061a5c83de
Author: Jens Georg <mail jensge org>
Date: Fri Jul 23 23:17:03 2010 +0300
media-export: Yet another database version
* Add a genre field to metadata
* Add a flag filed to object. Will be used to mark URIS as
DBus-originated
.../rygel-media-export-media-cache-upgrader.vala | 20 ++++++++++++++++++++
.../rygel-media-export-media-cache.vala | 6 ++++--
2 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-media-cache-upgrader.vala b/src/plugins/media-export/rygel-media-export-media-cache-upgrader.vala
index a4e7476..9e2b90c 100644
--- a/src/plugins/media-export/rygel-media-export-media-cache-upgrader.vala
+++ b/src/plugins/media-export/rygel-media-export-media-cache-upgrader.vala
@@ -100,6 +100,9 @@ internal class Rygel.MediaExport.MediaCacheUpgrader {
case 6:
update_v6_v7 ();
break;
+ case 7:
+ update_v7_v8 ();
+ break;
default:
warning ("Cannot upgrade");
database = null;
@@ -226,5 +229,22 @@ internal class Rygel.MediaExport.MediaCacheUpgrader {
}
}
+ private void update_v7_v8 () {
+ try {
+ database.begin ();
+ database.exec ("ALTER TABLE object ADD COLUMN flags TEXT");
+ database.exec ("ALTER TABLE meta_data ADD COLUMN genre TEXT");
+ database.exec ("UPDATE schema_info SET version = '8'");
+ force_reindex ();
+ database.commit ();
+ database.exec ("VACUUM");
+ database.analyze ();
+ } catch (DatabaseError error) {
+ database.rollback ();
+ warning ("Database upgrade failed: %s", error.message);
+ database = null;
+ }
+ }
+
}
diff --git a/src/plugins/media-export/rygel-media-export-media-cache.vala b/src/plugins/media-export/rygel-media-export-media-cache.vala
index c687af8..fd50eb0 100644
--- a/src/plugins/media-export/rygel-media-export-media-cache.vala
+++ b/src/plugins/media-export/rygel-media-export-media-cache.vala
@@ -45,7 +45,7 @@ public enum Rygel.MediaDBObjectType {
public class Rygel.MediaExport.MediaCache : Object {
private Database db;
private DBObjectFactory factory;
- internal const string schema_version = "7";
+ internal const string schema_version = "8";
internal const string CREATE_META_DATA_TABLE_STRING =
"CREATE TABLE meta_data (size INTEGER NOT NULL, " +
"mime_type TEXT NOT NULL, " +
@@ -56,6 +56,7 @@ public class Rygel.MediaExport.MediaCache : Object {
"class TEXT NOT NULL, " +
"author TEXT, " +
"album TEXT, " +
+ "genre TEXT, " +
"date TEXT, " +
"bitrate INTEGER, " +
"sample_freq INTEGER, " +
@@ -76,7 +77,8 @@ public class Rygel.MediaExport.MediaCache : Object {
"type_fk INTEGER, " +
"title TEXT NOT NULL, " +
"timestamp INTEGER NOT NULL, " +
- "uri TEXT);" +
+ "uri TEXT, " +
+ "flags TEXT);" +
"INSERT INTO schema_info (version) VALUES ('" +
MediaCache.schema_version + "'); ";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]