using MyAi.Data.Entities; using Microsoft.EntityFrameworkCore; namespace MyAi.Data; public sealed class MyAiDbContext : DbContext { public const string SchemaName = "myAi"; public const string MigrationTableName = "_MyAiMigrations"; public MyAiDbContext(DbContextOptions options) : base(options) { } public DbSet Templates => Set(); protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.HasDefaultSchema(SchemaName); modelBuilder.Entity(entity => { entity.ToTable("Templates"); entity.HasKey(x => new { x.Key, x.Language }); entity.Property(x => x.Key).HasMaxLength(128); entity.Property(x => x.Language).HasMaxLength(8); entity.Property(x => x.Value).IsRequired(); entity.Property(x => x.Description).HasMaxLength(500).HasDefaultValue(string.Empty); entity.Property(x => x.UpdatedAt).HasDefaultValueSql("SYSUTCDATETIME()"); }); } }