e7bb803ae2
- Rename EmailApiDbContext MigrationTableName from '_EmailApiMigrations' to '_Migrations' - Rename MyAiDbContext MigrationTableName from '_MyAiMigrations' to '_Migrations' - Add migrations to rename tables in database: emailApi._EmailApiMigrations → emailApi._Migrations, myAi._MyAiMigrations → myAi._Migrations - Aligns with naming convention used in other schemas (cvMatcher, cvSearch, rag) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
31 lines
1.0 KiB
C#
31 lines
1.0 KiB
C#
using MyAi.Data.Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace MyAi.Data;
|
|
|
|
public sealed class MyAiDbContext : DbContext
|
|
{
|
|
public const string SchemaName = "myAi";
|
|
public const string MigrationTableName = "_Migrations";
|
|
|
|
public MyAiDbContext(DbContextOptions<MyAiDbContext> options) : base(options) { }
|
|
|
|
public DbSet<TemplateEntity> Templates => Set<TemplateEntity>();
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.HasDefaultSchema(SchemaName);
|
|
|
|
modelBuilder.Entity<TemplateEntity>(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()");
|
|
});
|
|
}
|
|
}
|