diff --git a/Elwig/Helpers/AppDbUpdater.cs b/Elwig/Helpers/AppDbUpdater.cs index bdaffcb..6933870 100644 --- a/Elwig/Helpers/AppDbUpdater.cs +++ b/Elwig/Helpers/AppDbUpdater.cs @@ -9,7 +9,7 @@ namespace Elwig.Helpers { public static class AppDbUpdater { // Don't forget to update value in Tests/fetch-resources.bat! - public static readonly int RequiredSchemaVersion = 36; + public static readonly int RequiredSchemaVersion = 37; private static int VersionOffset = 0; diff --git a/Elwig/Resources/Sql/34-35.sql b/Elwig/Resources/Sql/34-35.sql index b0081ff..41c5888 100644 --- a/Elwig/Resources/Sql/34-35.sql +++ b/Elwig/Resources/Sql/34-35.sql @@ -1,6 +1,8 @@ -- schema version 34 to 35 +UPDATE client_parameter SET value = '0' WHERE param = 'ENABLE_TIME_TRIGGERS'; ALTER TABLE delivery_part ADD COLUMN unloading TEXT DEFAULT NULL; UPDATE delivery_part SET unloading = 'pumped' WHERE lesewagen; UPDATE delivery_part SET unloading = 'box' WHERE (SELECT zwstid IN ('H','S') FROM delivery d WHERE (d.year, d.did) = (delivery_part.year, delivery_part.did)); ALTER TABLE delivery_part DROP COLUMN lesewagen; +UPDATE client_parameter SET value = '1' WHERE param = 'ENABLE_TIME_TRIGGERS'; diff --git a/Elwig/Resources/Sql/36-37.sql b/Elwig/Resources/Sql/36-37.sql new file mode 100644 index 0000000..9170d72 --- /dev/null +++ b/Elwig/Resources/Sql/36-37.sql @@ -0,0 +1,12 @@ +-- schema version 36 to 37 + +UPDATE client_parameter SET value = '0' WHERE param = 'ENABLE_TIME_TRIGGERS'; + +-- fix old deliveries +UPDATE delivery SET xtime = NULL, mtime = ctime WHERE year <= 2022 AND mtime >= 1768521600 AND mtime < 1772323200; +UPDATE delivery_part SET xtime = NULL, mtime = ctime WHERE year <= 2022 AND mtime >= 1768521600 AND mtime < 1772323200; +-- clear xtime at one laptop to force updates from this one +UPDATE delivery SET xtime = NULL WHERE year >= 2023 AND xtime >= 1771200000 AND xtime < 1771286400; +UPDATE delivery_part SET xtime = NULL WHERE year >= 2023 AND xtime >= 1771200000 AND xtime < 1771286400; + +UPDATE client_parameter SET value = '1' WHERE param = 'ENABLE_TIME_TRIGGERS';