From 826a76c56c8c3c91499de9f5f9bc74cc6af2c4dc Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Tue, 19 Sep 2023 00:37:46 +0200 Subject: [PATCH] AppDbUpdater: Add schema_version 2 --- Elwig/Helpers/AppDbUpdater.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Elwig/Helpers/AppDbUpdater.cs b/Elwig/Helpers/AppDbUpdater.cs index f01203b..4f20c54 100644 --- a/Elwig/Helpers/AppDbUpdater.cs +++ b/Elwig/Helpers/AppDbUpdater.cs @@ -4,7 +4,7 @@ using System; namespace Elwig.Helpers { public static class AppDbUpdater { - public static readonly int RequiredSchemaVersion = 1; + public static readonly int RequiredSchemaVersion = 2; private static int _versionOffset = 0; private static readonly Action[] _updaters = new[] { @@ -74,7 +74,11 @@ namespace Elwig.Helpers { ExecuteNonQuery(cnx, $"PRAGMA schema_version = {toVersion * 100 + _versionOffset}"); } - private static void UpdateDbSchema_1_To_2(SqliteConnection cnx) { } + private static void UpdateDbSchema_1_To_2(SqliteConnection cnx) { + ExecuteNonQuery(cnx, "DROP VIEW v_area_commitment"); + ExecuteNonQuery(cnx, "ALTER TABLE delivery_part DROP COLUMN weighing_reason"); + ExecuteNonQuery(cnx, "ALTER TABLE delivery_part ADD COLUMN weighing_reason TEXT CHECK(NOT (manual_weighing = FALSE AND weighing_reason IS NOT NULL))"); + } private static void UpdateDbSchema_2_To_3(SqliteConnection cnx) { } }