Lots of data and model setup
This commit is contained in:
@@ -3,6 +3,7 @@ using DCGEngine.Database.Configuration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using SVSim.Database.Models;
|
||||
|
||||
namespace SVSim.Database;
|
||||
|
||||
@@ -11,4 +12,19 @@ public class SVSimDbContext : DCGEDbContext
|
||||
public SVSimDbContext(IOptions<DCGEDatabaseConfiguration> configuration, ILogger<DCGEDbContext> logger, DbContextOptions options) : base(configuration, logger, options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
// For whatever reason it cannot figure out this relationship on it's own
|
||||
modelBuilder.Entity<SleeveEntry>()
|
||||
.HasMany<Viewer>(se => se.Viewers)
|
||||
.WithMany(v => v.Sleeves);
|
||||
|
||||
modelBuilder.HasSequence<long>("ShortUdidSequence").StartsAt(400000000);
|
||||
modelBuilder.Entity<Viewer>()
|
||||
.Property(v => v.ShortUdid)
|
||||
.UseSequence("ShortUdidSequence");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user