26 lines
915 B
C#
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");
|
|
});
|
|
}
|
|
}
|