Added hash based optimization

This commit is contained in:
2025-06-11 13:23:02 +02:00
parent 371a16511a
commit e6211a185b
3 changed files with 75 additions and 32 deletions

View File

@@ -17,9 +17,13 @@ public static class DatabaseMigrations
databaseVersion = UpdateFrom1(helper); // TODO: Implement reflection based dynamic invocation.
goto case 2;
case 2:
databaseVersion = UpdateFrom2(helper);
goto case 3;
case 3:
default:
break;
}
helper.ExecuteSQLNonQuery("UPDATE settings SET value = @databaseVersion", new() { ["databaseVersion"] = databaseVersion.ToString() });
}
public static int DatabaseGetVersion(SQLHelper helper)
{
@@ -66,4 +70,11 @@ public static class DatabaseMigrations
helper.ExecuteSQLNonQuery("INSERT INTO settings (name, value) VALUES (\"DatabaseVersion\", \"2\");", []);
return 2;
}
public static int UpdateFrom2(SQLHelper helper)
{
helper.ExecuteSQLNonQuery("ALTER TABLE datapoint ADD hash VARCHAR(44);", []);
helper.ExecuteSQLNonQuery("UPDATE datapoint SET hash='';", []);
return 3;
}
}