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