OPC # 0001: Extract Clarity into standalone repo
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using Clarity.Server.Entity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Clarity.Server.Data
|
||||
{
|
||||
public class ApplicationDbContext : DbContext
|
||||
{
|
||||
public DbSet<Profile> Profiles => Set<Profile>();
|
||||
public DbSet<SysParams> SysParams => Set<SysParams>();
|
||||
|
||||
|
||||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Profile>(entity =>
|
||||
{
|
||||
entity.HasKey(p => p.Id);
|
||||
entity.HasIndex(p => p.KeycloakSubject).IsUnique();
|
||||
entity.Property(p => p.KeycloakSubject).IsRequired();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user