mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
20 lines
622 B
C#
20 lines
622 B
C#
using Kruzya.TelegramBot.Core.EF;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace West.TelegramBot.Reputation.Data;
|
|
|
|
public class ReputationContext : AutoSaveDbContext
|
|
{
|
|
public DbSet<UserReputation> UserReputation { get; set; } = null!;
|
|
|
|
public ReputationContext(DbContextOptions<ReputationContext> options) : base(options)
|
|
{
|
|
Database.EnsureCreated();
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.Entity<UserReputation>().HasKey(e => new {e.ChatId, e.UserId});
|
|
modelBuilder.Entity<UserReputation>().HasIndex(e => e.ChatId);
|
|
}
|
|
} |