[chronojump] DB: 2.27 Scheduled backups added 4 SQL variables



commit e914020da694c84d5c4a945941959a70f0f29de8
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Aug 17 19:33:26 2021 +0200

    DB: 2.27 Scheduled backups added 4 SQL variables

 src/sqlite/main.cs        | 15 +++++++++++++--
 src/sqlite/preferences.cs | 12 ++++++++++++
 2 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 7b7afff8c..c326050bd 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -129,7 +129,7 @@ class Sqlite
        /*
         * Important, change this if there's any update to database
         */
-       static string lastChronojumpDatabaseVersion = "2.26";
+       static string lastChronojumpDatabaseVersion = "2.27";
 
        public Sqlite()
        {
@@ -3054,6 +3054,17 @@ class Sqlite
 
                                currentVersion = updateVersion("2.26");
                        }
+                       if(currentVersion == "2.26")
+                       {
+                               LogB.SQL("Inserted lastBackupDir, lastBackupDatetime, 
backupScheduledCreatedDate, backupScheduledNextDays");
+
+                               SqlitePreferences.Insert (SqlitePreferences.LastBackupDirStr, "");
+                               SqlitePreferences.Insert (SqlitePreferences.LastBackupDatetimeStr, 
UtilDate.ToSql(DateTime.MinValue));
+                               SqlitePreferences.Insert (SqlitePreferences.BackupScheduledCreatedDateStr, 
UtilDate.ToSql(DateTime.MinValue));
+                               SqlitePreferences.Insert (SqlitePreferences.BackupScheduledNextDaysStr, "30");
+
+                               currentVersion = updateVersion("2.27");
+                       }
 
 
                        /*
@@ -3274,7 +3285,7 @@ class Sqlite
                //changes [from - to - desc]
 //just testing: 1.79 - 1.80 Converted DB to 1.80 Created table ForceSensorElasticBandGlue and moved 
stiffnessString records there
 
-
+               //2.26 - 2.27 Converted DB to 2.27 Inserted lastBackupDir, lastBackupDatetime, 
backupScheduledCreatedDate, backupScheduledNextDays
                //2.25 - 2.26 Converted DB to 2.26 contactsCaptureDisplay with BooleansInt, and bool 
runEncoderCaptureDisplaySimple
                //2.24 - 2.25 Converted DB to 2.25 encoderCaptureShowOnlyBars now uses BooleansInt
                //2.23 - 2.24 Converted DB to 2.24 LogoAnimatedShow made False by default on Mac
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index e99304a64..a87409f26 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -36,6 +36,12 @@ class SqlitePreferences : Sqlite
        public const string RestTimeMinutes = "restTimeMinutes";
        public const string RestTimeSeconds = "restTimeSeconds";
 
+       //backup (scheduled or not)
+       public const string LastBackupDirStr = "lastBackupDir";
+       public const string LastBackupDatetimeStr = "lastBackupDatetime"; //merely informational
+       public const string BackupScheduledCreatedDateStr = "backupScheduledCreatedDate"; //when was 
scheduled (not when is the backup)
+       public const string BackupScheduledNextDaysStr = "backupScheduledNextDays"; // days to the backup (-1 
is no scheduled backup and never ask again, 1 is tomorrow, 90 is 90 days)
+
        //person (appearance)
        public const string PersonSelectWinImages = "personSelectWinImages";
 
@@ -188,6 +194,12 @@ class SqlitePreferences : Sqlite
                                Insert (UnitsStr, Preferences.UnitsEnum.METRIC.ToString(), dbcmdTr);
                                Insert (EncoderCaptureInfinite, "False", dbcmdTr);
 
+                               //backup
+                               Insert (LastBackupDirStr, "", dbcmdTr);
+                               Insert (LastBackupDatetimeStr, UtilDate.ToSql(DateTime.MinValue), dbcmdTr);
+                               Insert (BackupScheduledCreatedDateStr, UtilDate.ToSql(DateTime.MinValue), 
dbcmdTr);
+                               Insert (BackupScheduledNextDaysStr, "30", dbcmdTr);
+
                                Insert(ContactsCaptureDisplayStr, new ContactsCaptureDisplay(false, 
true).GetInt.ToString(), dbcmdTr);
                                Insert ("encoderCaptureShowOnlyBars", new EncoderCaptureDisplay(false, false, 
true).GetInt.ToString(), dbcmdTr);
                                Insert(RunEncoderCaptureDisplaySimple, "True", dbcmdTr);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]