AppDbUpdater: Add schema_version 2

This commit is contained in:
2023-09-19 00:37:46 +02:00
parent efaae5f490
commit 826a76c56c

View File

@ -4,7 +4,7 @@ using System;
namespace Elwig.Helpers { namespace Elwig.Helpers {
public static class AppDbUpdater { public static class AppDbUpdater {
public static readonly int RequiredSchemaVersion = 1; public static readonly int RequiredSchemaVersion = 2;
private static int _versionOffset = 0; private static int _versionOffset = 0;
private static readonly Action<SqliteConnection>[] _updaters = new[] { private static readonly Action<SqliteConnection>[] _updaters = new[] {
@ -74,7 +74,11 @@ namespace Elwig.Helpers {
ExecuteNonQuery(cnx, $"PRAGMA schema_version = {toVersion * 100 + _versionOffset}"); 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) { } private static void UpdateDbSchema_2_To_3(SqliteConnection cnx) { }
} }