Improved logging system.
This commit is contained in:
parent
d94b1cb813
commit
98d13ebbbb
24 changed files with 202 additions and 142 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue