[banshee] Database: refactoring, split method in three
- From: AndrÃs Aragoneses <aaragoneses src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] Database: refactoring, split method in three
- Date: Thu, 3 Nov 2011 00:22:05 +0000 (UTC)
commit eec1d2be4b36cc2526da2a94c0987ba0ec4e1df6
Author: AndrÃs G. Aragoneses <knocte gmail com>
Date: Thu Nov 3 00:17:16 2011 +0000
Database: refactoring, split method in three
Refactor this huge method in BansheeDbFormatMigrator
into three smaller ones.
There is no change of behaviour in this commit.
.../Banshee.Database/BansheeDbFormatMigrator.cs | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs b/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
index fb95f26..131393d 100644
--- a/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
+++ b/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
@@ -964,6 +964,15 @@ namespace Banshee.Database
private void InitializeFreshDatabase (bool refresh_metadata)
{
+ DropTables ();
+
+ CreateConfiguration (refresh_metadata);
+
+ CreateTablesAndIndexes ();
+ }
+
+ private void DropTables ()
+ {
Execute("DROP TABLE IF EXISTS CoreConfiguration");
Execute("DROP TABLE IF EXISTS CoreTracks");
Execute("DROP TABLE IF EXISTS CoreArtists");
@@ -975,7 +984,10 @@ namespace Banshee.Database
Execute("DROP TABLE IF EXISTS CoreRemovedTracks");
Execute("DROP TABLE IF EXISTS CoreTracksCache");
Execute("DROP TABLE IF EXISTS CoreCache");
+ }
+ private void CreateConfiguration (bool refresh_metadata)
+ {
Execute(@"
CREATE TABLE CoreConfiguration (
EntryID INTEGER PRIMARY KEY,
@@ -987,7 +999,10 @@ namespace Banshee.Database
if (!refresh_metadata) {
Execute (String.Format ("INSERT INTO CoreConfiguration (EntryID, Key, Value) VALUES (null, 'MetadataVersion', {0})", CURRENT_METADATA_VERSION));
}
+ }
+ private void CreateTablesAndIndexes ()
+ {
Execute(@"
CREATE TABLE CorePrimarySources (
PrimarySourceID INTEGER PRIMARY KEY,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]