Improved logging system.

This commit is contained in:
flash 2025-04-28 12:29:11 +00:00
commit 98d13ebbbb
Signed by: flash
GPG key ID: 2C9C2C574D47FE3E
24 changed files with 202 additions and 142 deletions

View file

@ -1,12 +1,16 @@
using Microsoft.Extensions.Logging;
using ZLogger;
namespace SharpChat.SQLite;
public class SQLiteMigrations(SQLiteConnection conn) {
public class SQLiteMigrations(ILogger logger, SQLiteConnection conn) {
public async Task RunMigrations() {
long currentVersion = await conn.RunQueryValue<long>("PRAGMA user_version");
long version = currentVersion;
async Task doMigration(int expect, Func<Task> action) {
if(version < expect) {
logger.ZLogInformation($"Upgrading to version {version}...");
await action();
++version;
}