2024-02-07 15:40:36 +00:00
|
|
|
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
|
2023-11-20 18:58:30 +00:00
|
|
|
|
2024-01-29 07:39:18 +00:00
|
|
|
using Continuity.AuthServer.DB.Documents;
|
2023-11-16 11:06:36 +00:00
|
|
|
using JetBrains.Annotations;
|
2023-11-19 16:07:28 +00:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
2023-11-16 11:06:36 +00:00
|
|
|
|
2024-01-29 07:39:18 +00:00
|
|
|
namespace Continuity.AuthServer.DB;
|
2023-08-10 08:47:35 +00:00
|
|
|
|
2025-01-16 13:30:40 +00:00
|
|
|
public class WonderkingContext : DbContext {
|
|
|
|
public WonderkingContext([NotNull] DbContextOptions options) : base(options) {
|
2023-08-10 08:47:35 +00:00
|
|
|
}
|
2023-08-12 21:02:59 +00:00
|
|
|
|
2023-08-14 19:30:32 +00:00
|
|
|
public DbSet<Account> Accounts { get; set; }
|
2023-08-14 20:30:35 +00:00
|
|
|
public DbSet<Character> Characters { get; set; }
|
2023-11-20 18:50:09 +00:00
|
|
|
public DbSet<InventoryItem> InventoryItems { get; set; }
|
|
|
|
public DbSet<Guild> Guilds { get; set; }
|
2025-01-16 13:30:40 +00:00
|
|
|
|
|
|
|
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");
|
|
|
|
});
|
|
|
|
}
|
2023-08-11 09:31:30 +00:00
|
|
|
}
|