[chronojump/FS-TFT-Menu] DB: 2.37. ALTER TABLE encoder add repCriteria



commit bba6f5d7bd7b864cc6ce6abbe1bf95e8b463967c
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Apr 8 12:22:29 2022 +0200

    DB: 2.37. ALTER TABLE encoder add repCriteria

 src/sqlite/encoder.cs |  3 ++-
 src/sqlite/main.cs    | 18 +++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index be06984e6..81b550a3c 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -61,7 +61,8 @@ class SqliteEncoder : Sqlite
                        "future1 TEXT, " +      //Since 1.4.4 (DB 1.06) this stores last meanPower detected 
on a curve 
                                                //(as string with '.' because future1 was created as TEXT)
                        "future2 TEXT, " +      //same as future1
-                       "future3 TEXT )";       //same as future1
+                       "future3 TEXT, " +      //same as future1
+                       "repCriteria TEXT )";   //criteria of meanPower, meanSpeed, meanForce: ecc_con, ecc, 
con
                dbcmd.ExecuteNonQuery();
        }
        
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index a4ca3b65c..0860dc3ba 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -131,7 +131,7 @@ class Sqlite
        /*
         * Important, change this if there's any update to database
         */
-       static string lastChronojumpDatabaseVersion = "2.36";
+       static string lastChronojumpDatabaseVersion = "2.37";
 
        public Sqlite()
        {
@@ -3224,6 +3224,21 @@ class Sqlite
 
                                currentVersion = updateVersion("2.36");
                        }
+                       if(currentVersion == "2.36")
+                       {
+                               LogB.SQL("Doing ALTER TABLE encoder add repCriteria.");
+
+                               try {
+                                       executeSQL("ALTER TABLE " + Constants.EncoderTable +
+                                                       " ADD COLUMN repCriteria TEXT NOT NULL DEFAULT " + 
//TODO: try to do the migration and see if overview works ok
+                                                       Preferences.EncoderRepetitionCriteria.CON.ToString() 
+ ";");
+                                                       //note this will make the encoder sets (signals) have 
CON on this columns, but this will not be used on signals, only on curves
+                               } catch {
+                                       LogB.SQL("Catched at Doing ALTER TABLE encoder add repCriteria.");
+                               }
+
+                               currentVersion = updateVersion("2.37");
+                       }
 
                        /*
                        if(currentVersion == "1.79")
@@ -3445,6 +3460,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.36 - 2.37 Converted DB to 2.37 Doing ALTER TABLE encoder add repCriteria.
                //2.35 - 2.36 Converted DB to 2.36 Inserted into preferences: 
encoderRepetitionCriteriaGravitatory, encoderRepetitionCriteriaInertial
                //2.34 - 2.35 Converted DB to 2.35 Ensure maxForceRAW is converted to maxForceRaw
                //2.33 - 2.34 Converted DB to 2.34 Fixed duplicated names of exercises on encoder, 
forceSensor, raceAnalyzer caused by import bug


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