continuity/Continuity.AuthServer/DB/WonderkingContext.cs
Timothy Schenk 3a24dabdf2
chore: formatting and slnx
Signed-off-by: Timothy Schenk <admin@rainote.dev>
2025-01-16 14:30:40 +01:00

26 lines
915 B
C#

// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
using Continuity.AuthServer.DB.Documents;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore;
namespace Continuity.AuthServer.DB;
public class WonderkingContext : DbContext {
public WonderkingContext([NotNull] DbContextOptions options) : base(options) {
}
public DbSet<Account> Accounts { get; set; }
public DbSet<Character> Characters { get; set; }
public DbSet<InventoryItem> InventoryItems { get; set; }
public DbSet<Guild> Guilds { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder) {
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Account>(entity => {
entity.HasIndex(e => e.Username).IsUnique();
entity.HasIndex(e => e.Id).IsUnique();
entity.Property(e => e.Id).HasColumnType("uuid");
});
}
}