From 1083311f8ca53aa53cf689113c46e35d9e6648db Mon Sep 17 00:00:00 2001 From: Florian Kuepper Date: Fri, 21 Dec 2012 12:10:49 +0100 Subject: [PATCH] Add function to update db to v3 --- Vocaluxe/Base/CDataBase.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index 8cd56939..4806773b 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -1005,6 +1005,25 @@ namespace Vocaluxe.Base return true; } + private static bool ConvertV2toV3(SQLiteConnection connection) + { + SQLiteCommand command; + + command = new SQLiteCommand(connection); + + command.CommandText = "ALTER TABLE Songs ADD DateAdded BIGINT"; + command.ExecuteNonQuery(); + command.CommandText = "UPDATE Songs SET [DateAdded] = @DateAdded"; + command.Parameters.Add("@DateAdded",System.Data.DbType.Int64, 0).Value = DateTime.Now.Ticks; + command.ExecuteNonQuery(); + command.CommandText = "UPDATE Version SET [Value] = @version"; + command.Parameters.Add("@version", System.Data.DbType.Int32, 0).Value = 2; + command.ExecuteNonQuery(); + command.Dispose(); + + return true; + } + private static bool ImportData(string SourceDBPath, string DestinationDBPath) { #region open db