Исправление: том ./mods:/lampac/mods в compose и копии 10 модулей с enable:true; конфиг без SkipModules

This commit is contained in:
2026-10-02 12:11:49 +03:00
parent 8dcbc6bc52
commit 7b8e28b3bf
151 changed files with 68625 additions and 44 deletions
+48
View File
@@ -0,0 +1,48 @@
using System;
using System.IO;
using Microsoft.EntityFrameworkCore;
using Telemetry.Models;
namespace Telemetry;
public class AppDbContext : DbContext
{
public DbSet<LogModelSql> Logs { get; set; } = null!;
public DbSet<UserInfoModelSql> Users { get; set; } = null!;
public AppDbContext() : base() { }
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
var dbPath = ModInit.DbPath;
var dbDir = Path.GetDirectoryName(dbPath);
if (dbDir != null && !Directory.Exists(dbDir)) Directory.CreateDirectory(dbDir);
optionsBuilder.UseSqlite($"Data Source={dbPath};Cache=Shared");
optionsBuilder.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<LogModelSql>()
.HasIndex(l => l.Time);
modelBuilder.Entity<LogModelSql>()
.HasIndex(l => new { l.Uid, l.Time });
modelBuilder.Entity<LogModelSql>()
.HasIndex(l => new { l.Balancer, l.Time });
modelBuilder.Entity<LogModelSql>()
.HasIndex(l => l.UnfoId);
modelBuilder.Entity<UserInfoModelSql>()
.HasKey(u => u.Id);
modelBuilder.Entity<UserInfoModelSql>()
.HasIndex(u => u.Ip);
}
}