case 6:
update_v6_v7 ();
break;
+ case 7:
+ update_v7_v8 ();
+ break;
default:
warning ("Cannot upgrade");
database = null;
}
}
+ 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;
+ }
+ }
+
}
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, " +
"class TEXT NOT NULL, " +
"author TEXT, " +
"album TEXT, " +
+ "genre TEXT, " +
"date TEXT, " +
"bitrate INTEGER, " +
"sample_freq INTEGER, " +
"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 + "'); ";