Update application core

This commit is contained in:
Tech Garage 2024-01-25 20:38:47 +03:30
parent 6655664ed6
commit c118242c5b
5 changed files with 474 additions and 27 deletions

View file

@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
using MTWireGuard.Application.Models;
using MTWireGuard.Application.Models.Mikrotik;
namespace MTWireGuard.Application
@ -6,6 +7,9 @@ namespace MTWireGuard.Application
public class DBContext : DbContext
{
public DbSet<WGPeerDBModel> Users { get; set; }
public DbSet<WGServerDBModel> Servers { get; set; }
public DbSet<DataUsage> DataUsages { get; set; }
public DbSet<LastKnownTraffic> LastKnownTraffic { get; set; }
public string DbPath { get; }
@ -15,7 +19,11 @@ namespace MTWireGuard.Application
}
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source={DbPath}");
{
options.UseSqlite($"Data Source={DbPath}", opt =>
{
opt.MigrationsAssembly("MTWireGuard.Application");
});
}
}
}