From 06bc00bc2cb064a1a71908d66523e6ff7555efa6 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Mon, 16 Oct 2023 20:41:01 +0200 Subject: [PATCH 1/6] Adapt reviews and votes to include team at fault option --- src/iRLeagueDatabaseCore/Models/AcceptedReviewVoteEntity.cs | 6 ++++++ src/iRLeagueDatabaseCore/Models/IncidentReviewEntity.cs | 5 +++++ src/iRLeagueDatabaseCore/Models/ReviewCommentVoteEntity.cs | 6 ++++++ src/iRLeagueDatabaseCore/Models/TeamEntity.cs | 1 + 4 files changed, 18 insertions(+) diff --git a/src/iRLeagueDatabaseCore/Models/AcceptedReviewVoteEntity.cs b/src/iRLeagueDatabaseCore/Models/AcceptedReviewVoteEntity.cs index 5ea0569..b31a7ca 100644 --- a/src/iRLeagueDatabaseCore/Models/AcceptedReviewVoteEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/AcceptedReviewVoteEntity.cs @@ -13,6 +13,7 @@ public AcceptedReviewVoteEntity() public long LeagueId { get; set; } public long ReviewId { get; set; } public long? MemberAtFaultId { get; set; } + public long? TeamAtFaultId { get; set; } public long? VoteCategoryId { get; set; } public string Description { get; set; } /// @@ -23,6 +24,7 @@ public AcceptedReviewVoteEntity() public virtual VoteCategoryEntity VoteCategory { get; set; } public virtual MemberEntity MemberAtFault { get; set; } + public virtual TeamEntity TeamAtFault { get; set; } public virtual IncidentReviewEntity Review { get; set; } public virtual ICollection ReviewPenaltys { get; set; } } @@ -52,6 +54,10 @@ public void Configure(EntityTypeBuilder entity) .WithMany(p => p.AcceptedReviewVotes) .HasForeignKey(d => d.MemberAtFaultId); + entity.HasOne(d => d.TeamAtFault) + .WithMany() + .HasForeignKey(d => new { d.LeagueId, d.TeamAtFaultId }); + entity.HasOne(d => d.Review) .WithMany(p => p.AcceptedReviewVotes) .HasForeignKey(d => new { d.LeagueId, d.ReviewId }); diff --git a/src/iRLeagueDatabaseCore/Models/IncidentReviewEntity.cs b/src/iRLeagueDatabaseCore/Models/IncidentReviewEntity.cs index a54a5f6..55f5735 100644 --- a/src/iRLeagueDatabaseCore/Models/IncidentReviewEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/IncidentReviewEntity.cs @@ -42,6 +42,7 @@ public IncidentReviewEntity() public virtual ICollection AcceptedReviewVotes { get; set; } public virtual ICollection Comments { get; set; } public virtual ICollection InvolvedMembers { get; set; } + public virtual ICollection InvolvedTeams { get; set; } public virtual ICollection ReviewPenaltys { get; set; } } @@ -73,5 +74,9 @@ public void Configure(EntityTypeBuilder entity) entity.HasMany(d => d.InvolvedMembers) .WithMany(p => p.InvolvedReviews) .UsingEntity(e => e.ToTable("IncidentReviewsInvolvedMembers")); + + entity.HasMany(d => d.InvolvedTeams) + .WithMany(p => p.InvolvedReviews) + .UsingEntity(e => e.ToTable("IncidentReviewsInvolvedTeams")); } } diff --git a/src/iRLeagueDatabaseCore/Models/ReviewCommentVoteEntity.cs b/src/iRLeagueDatabaseCore/Models/ReviewCommentVoteEntity.cs index 89df2ca..3a97fc7 100644 --- a/src/iRLeagueDatabaseCore/Models/ReviewCommentVoteEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/ReviewCommentVoteEntity.cs @@ -8,6 +8,7 @@ public partial class ReviewCommentVoteEntity public long ReviewVoteId { get; set; } public long CommentId { get; set; } public long? MemberAtFaultId { get; set; } + public long? TeamAtFaultId { get; set; } public long? VoteCategoryId { get; set; } public string Description { get; set; } /// @@ -19,6 +20,7 @@ public partial class ReviewCommentVoteEntity public virtual ReviewCommentEntity Comment { get; set; } public virtual VoteCategoryEntity VoteCategory { get; set; } public virtual MemberEntity MemberAtFault { get; set; } + public virtual TeamEntity TeamAtFault { get; set;} } public class CommentReviewVoteEntityConfiguration : IEntityTypeConfiguration @@ -49,5 +51,9 @@ public void Configure(EntityTypeBuilder entity) entity.HasOne(d => d.MemberAtFault) .WithMany(p => p.CommentReviewVotes) .HasForeignKey(d => d.MemberAtFaultId); + + entity.HasOne(d => d.TeamAtFault) + .WithMany() + .HasForeignKey(d => new { d.LeagueId, d.TeamAtFaultId }); } } diff --git a/src/iRLeagueDatabaseCore/Models/TeamEntity.cs b/src/iRLeagueDatabaseCore/Models/TeamEntity.cs index f24be1f..4d3762d 100644 --- a/src/iRLeagueDatabaseCore/Models/TeamEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/TeamEntity.cs @@ -31,6 +31,7 @@ public TeamEntity() public virtual ICollection Members { get; set; } public virtual LeagueEntity League { get; set; } + public virtual IEnumerable InvolvedReviews { get; set; } } public class TeamEntityConfiguration : IEntityTypeConfiguration From 15f5f39dad7e1bafb94fb40f6bca23068bcd18c1 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Mon, 16 Oct 2023 21:13:09 +0200 Subject: [PATCH 2/6] Add migration for Team at fault reviews --- src/iRLeagueDatabaseCore/LeagueDbContext.cs | 2 + ...31016191207_ReviewsTeamAtFault.Designer.cs | 3940 +++++++++++++++++ .../20231016191207_ReviewsTeamAtFault.cs | 113 + .../LeagueDbContextModelSnapshot.cs | 61 + .../Models/IncidentReviewEntity.cs | 5 +- .../Models/IncidentReviewsInvolvedTeams.cs | 11 + .../iRLeagueDatabaseCore.csproj | 2 +- 7 files changed, 4132 insertions(+), 2 deletions(-) create mode 100644 src/iRLeagueDatabaseCore/Migrations/20231016191207_ReviewsTeamAtFault.Designer.cs create mode 100644 src/iRLeagueDatabaseCore/Migrations/20231016191207_ReviewsTeamAtFault.cs create mode 100644 src/iRLeagueDatabaseCore/Models/IncidentReviewsInvolvedTeams.cs diff --git a/src/iRLeagueDatabaseCore/LeagueDbContext.cs b/src/iRLeagueDatabaseCore/LeagueDbContext.cs index 5b0bf8e..31626fc 100644 --- a/src/iRLeagueDatabaseCore/LeagueDbContext.cs +++ b/src/iRLeagueDatabaseCore/LeagueDbContext.cs @@ -95,6 +95,8 @@ private void ConfigureMultiTenancy(ModelBuilder builder) .HasQueryFilter(mt => mt.LeagueId == LeagueProvider.LeagueId); builder.Entity() .HasQueryFilter(mt => mt.LeagueId == LeagueProvider.LeagueId); + builder.Entity() + .HasQueryFilter(mt => mt.LeagueId == LeagueProvider.LeagueId); builder.Entity() .HasQueryFilter(mt => mt.LeagueId == LeagueProvider.LeagueId); builder.Entity() diff --git a/src/iRLeagueDatabaseCore/Migrations/20231016191207_ReviewsTeamAtFault.Designer.cs b/src/iRLeagueDatabaseCore/Migrations/20231016191207_ReviewsTeamAtFault.Designer.cs new file mode 100644 index 0000000..bcaa193 --- /dev/null +++ b/src/iRLeagueDatabaseCore/Migrations/20231016191207_ReviewsTeamAtFault.Designer.cs @@ -0,0 +1,3940 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using iRLeagueDatabaseCore.Models; + +#nullable disable + +namespace iRLeagueDatabaseCore.Migrations +{ + [DbContext(typeof(LeagueDbContext))] + [Migration("20231016191207_ReviewsTeamAtFault")] + partial class ReviewsTeamAtFault + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseCollation("Latin1_General_CI_AS") + .HasAnnotation("ProductVersion", "6.0.7") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("IncidentReviewEntityMemberEntity", b => + { + b.Property("InvolvedMembersId") + .HasColumnType("bigint"); + + b.Property("InvolvedReviewsLeagueId") + .HasColumnType("bigint"); + + b.Property("InvolvedReviewsReviewId") + .HasColumnType("bigint"); + + b.HasKey("InvolvedMembersId", "InvolvedReviewsLeagueId", "InvolvedReviewsReviewId"); + + b.HasIndex("InvolvedReviewsLeagueId", "InvolvedReviewsReviewId"); + + b.ToTable("IncidentReviewsInvolvedMembers", (string)null); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.AcceptedReviewVoteEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ReviewVoteId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("MemberAtFaultId") + .HasColumnType("bigint"); + + b.Property("ReviewId") + .HasColumnType("bigint"); + + b.Property("TeamAtFaultId") + .HasColumnType("bigint"); + + b.Property("VoteCategoryId") + .HasColumnType("bigint"); + + b.HasKey("LeagueId", "ReviewVoteId"); + + b.HasAlternateKey("ReviewVoteId"); + + b.HasIndex("MemberAtFaultId"); + + b.HasIndex("ReviewId"); + + b.HasIndex("VoteCategoryId"); + + b.HasIndex("LeagueId", "ReviewId"); + + b.HasIndex("LeagueId", "TeamAtFaultId"); + + b.HasIndex("LeagueId", "VoteCategoryId"); + + b.ToTable("AcceptedReviewVotes"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.AddPenaltyEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("AddPenaltyId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Corner") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Lap") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Reason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("ScoredResultRowId") + .HasColumnType("bigint"); + + b.Property("Value") + .HasColumnType("json"); + + b.HasKey("LeagueId", "AddPenaltyId"); + + b.HasAlternateKey("AddPenaltyId"); + + b.HasIndex("LeagueId", "ScoredResultRowId"); + + b.ToTable("AddPenaltys"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.AutoPenaltyConfigEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("PenaltyConfigId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Conditions") + .IsRequired() + .HasColumnType("json"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PointRuleId") + .HasColumnType("bigint"); + + b.Property("Points") + .HasColumnType("int"); + + b.Property("Positions") + .HasColumnType("int"); + + b.Property("Time") + .HasColumnType("time(6)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("LeagueId", "PenaltyConfigId"); + + b.HasAlternateKey("PenaltyConfigId"); + + b.HasIndex("LeagueId", "PointRuleId"); + + b.ToTable("AutoPenaltyConfigs", (string)null); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ChampionshipEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ChampionshipId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime(6)"); + + b.Property("DisplayName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("IsArchived") + .HasColumnType("tinyint(1)"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .HasMaxLength(80) + .HasColumnType("varchar(80)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "ChampionshipId"); + + b.HasAlternateKey("ChampionshipId"); + + b.ToTable("Championships", (string)null); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ChampSeasonEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ChampSeasonId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ChampionshipId") + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime(6)"); + + b.Property("DefaultResultConfigId") + .HasColumnType("bigint"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime(6)"); + + b.Property("ResultKind") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("SeasonId") + .HasColumnType("bigint"); + + b.Property("StandingConfigId") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "ChampSeasonId"); + + b.HasAlternateKey("ChampSeasonId"); + + b.HasIndex("LeagueId", "ChampionshipId"); + + b.HasIndex("LeagueId", "DefaultResultConfigId"); + + b.HasIndex("LeagueId", "SeasonId"); + + b.HasIndex("LeagueId", "StandingConfigId"); + + b.ToTable("ChampSeasons", (string)null); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.CustomIncidentEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("IncidentId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("Text") + .HasColumnType("longtext"); + + b.HasKey("LeagueId", "IncidentId"); + + b.HasAlternateKey("IncidentId"); + + b.ToTable("CustomIncidents"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.DriverStatisticRowEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("StatisticSetId") + .HasColumnType("bigint"); + + b.Property("MemberId") + .HasColumnType("bigint"); + + b.Property("AvgFinalPosition") + .HasColumnType("double"); + + b.Property("AvgFinishPosition") + .HasColumnType("double"); + + b.Property("AvgIRating") + .HasColumnType("double"); + + b.Property("AvgIncidentsPerKm") + .HasColumnType("double"); + + b.Property("AvgIncidentsPerLap") + .HasColumnType("double"); + + b.Property("AvgIncidentsPerRace") + .HasColumnType("double"); + + b.Property("AvgPenaltyPointsPerKm") + .HasColumnType("double"); + + b.Property("AvgPenaltyPointsPerLap") + .HasColumnType("double"); + + b.Property("AvgPenaltyPointsPerRace") + .HasColumnType("double"); + + b.Property("AvgPointsPerRace") + .HasColumnType("double"); + + b.Property("AvgSRating") + .HasColumnType("double"); + + b.Property("AvgStartPosition") + .HasColumnType("double"); + + b.Property("BestFinalPosition") + .HasColumnType("int"); + + b.Property("BestFinishPosition") + .HasColumnType("double"); + + b.Property("BestStartPosition") + .HasColumnType("double"); + + b.Property("BonusPoints") + .HasColumnType("double"); + + b.Property("CleanestDriverAwards") + .HasColumnType("int"); + + b.Property("CompletedLaps") + .HasColumnType("double"); + + b.Property("CurrentSeasonPosition") + .HasColumnType("int"); + + b.Property("DrivenKm") + .HasColumnType("double"); + + b.Property("EndIRating") + .HasColumnType("int"); + + b.Property("EndSRating") + .HasColumnType("double"); + + b.Property("FastestLaps") + .HasColumnType("int"); + + b.Property("FirstRaceDate") + .HasColumnType("datetime"); + + b.Property("FirstRaceFinalPosition") + .HasColumnType("int"); + + b.Property("FirstRaceFinishPosition") + .HasColumnType("double"); + + b.Property("FirstRaceId") + .HasColumnType("bigint"); + + b.Property("FirstRaceStartPosition") + .HasColumnType("double"); + + b.Property("FirstResultRowId") + .HasColumnType("bigint"); + + b.Property("FirstSessionDate") + .HasColumnType("datetime"); + + b.Property("FirstSessionId") + .HasColumnType("bigint"); + + b.Property("HardChargerAwards") + .HasColumnType("int"); + + b.Property("Incidents") + .HasColumnType("double"); + + b.Property("IncidentsUnderInvestigation") + .HasColumnType("int"); + + b.Property("IncidentsWithPenalty") + .HasColumnType("int"); + + b.Property("LastRaceDate") + .HasColumnType("datetime"); + + b.Property("LastRaceFinalPosition") + .HasColumnType("int"); + + b.Property("LastRaceFinishPosition") + .HasColumnType("double"); + + b.Property("LastRaceId") + .HasColumnType("bigint"); + + b.Property("LastRaceStartPosition") + .HasColumnType("double"); + + b.Property("LastResultRowId") + .HasColumnType("bigint"); + + b.Property("LastSessionDate") + .HasColumnType("datetime"); + + b.Property("LastSessionId") + .HasColumnType("bigint"); + + b.Property("LeadingKm") + .HasColumnType("double"); + + b.Property("LeadingLaps") + .HasColumnType("double"); + + b.Property("PenaltyPoints") + .HasColumnType("double"); + + b.Property("Poles") + .HasColumnType("int"); + + b.Property("RacePoints") + .HasColumnType("double"); + + b.Property("Races") + .HasColumnType("int"); + + b.Property("RacesCompleted") + .HasColumnType("int"); + + b.Property("RacesInPoints") + .HasColumnType("int"); + + b.Property("StartIRating") + .HasColumnType("int"); + + b.Property("StartSRating") + .HasColumnType("double"); + + b.Property("Titles") + .HasColumnType("int"); + + b.Property("Top10") + .HasColumnType("int"); + + b.Property("Top15") + .HasColumnType("int"); + + b.Property("Top20") + .HasColumnType("int"); + + b.Property("Top25") + .HasColumnType("int"); + + b.Property("Top3") + .HasColumnType("int"); + + b.Property("Top5") + .HasColumnType("int"); + + b.Property("TotalPoints") + .HasColumnType("double"); + + b.Property("Wins") + .HasColumnType("int"); + + b.Property("WorstFinalPosition") + .HasColumnType("int"); + + b.Property("WorstFinishPosition") + .HasColumnType("double"); + + b.Property("WorstStartPosition") + .HasColumnType("double"); + + b.HasKey("LeagueId", "StatisticSetId", "MemberId"); + + b.HasIndex("MemberId"); + + b.HasIndex("StatisticSetId"); + + b.HasIndex("LeagueId", "FirstRaceId"); + + b.HasIndex("LeagueId", "FirstResultRowId"); + + b.HasIndex("LeagueId", "FirstSessionId"); + + b.HasIndex("LeagueId", "LastRaceId"); + + b.HasIndex("LeagueId", "LastResultRowId"); + + b.HasIndex("LeagueId", "LastSessionId"); + + b.ToTable("DriverStatisticRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.EventEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("EventId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("Date") + .HasColumnType("datetime"); + + b.Property("Duration") + .HasColumnType("bigint"); + + b.Property("EventType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("IrResultLink") + .HasColumnType("longtext"); + + b.Property("IrSessionId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("ScheduleId") + .HasColumnType("bigint"); + + b.Property("TrackId") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "EventId"); + + b.HasAlternateKey("EventId"); + + b.HasIndex("TrackId"); + + b.HasIndex("LeagueId", "ScheduleId"); + + b.ToTable("Events"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.EventResultConfigs", b => + { + b.Property("EventRefId") + .HasColumnType("bigint"); + + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ResultConfigRefId") + .HasColumnType("bigint"); + + b.HasKey("EventRefId", "LeagueId", "ResultConfigRefId"); + + b.HasIndex("LeagueId", "EventRefId"); + + b.HasIndex("LeagueId", "ResultConfigRefId"); + + b.ToTable("EventResultConfigs"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.EventResultEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("EventId") + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("RequiresRecalculation") + .HasColumnType("tinyint(1)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "EventId"); + + b.HasIndex("EventId"); + + b.ToTable("EventResults"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.FilterOptionEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("FilterOptionId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ChampSeasonId") + .HasColumnType("bigint"); + + b.Property("Conditions") + .IsRequired() + .HasColumnType("json"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("PointFilterResultConfigId") + .HasColumnType("bigint"); + + b.Property("ResultFilterResultConfigId") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "FilterOptionId"); + + b.HasAlternateKey("FilterOptionId"); + + b.HasIndex("LeagueId", "ChampSeasonId"); + + b.HasIndex("LeagueId", "PointFilterResultConfigId"); + + b.HasIndex("LeagueId", "ResultFilterResultConfigId"); + + b.ToTable("FilterOptions"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IncidentReviewEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ReviewId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("AuthorName") + .HasColumnType("longtext"); + + b.Property("AuthorUserId") + .HasColumnType("longtext"); + + b.Property("Corner") + .HasColumnType("longtext"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("FullDescription") + .HasColumnType("longtext"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("IncidentKind") + .HasColumnType("longtext"); + + b.Property("IncidentNr") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("OnLap") + .HasColumnType("longtext"); + + b.Property("ResultLongText") + .HasColumnType("longtext"); + + b.Property("SessionId") + .HasColumnType("bigint"); + + b.Property("TimeStamp") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "ReviewId"); + + b.HasAlternateKey("ReviewId"); + + b.HasIndex("SessionId"); + + b.HasIndex("LeagueId", "SessionId"); + + b.ToTable("IncidentReviews"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IncidentReviewsInvolvedTeams", b => + { + b.Property("ReviewRefId") + .HasColumnType("bigint"); + + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("TeamRefId") + .HasColumnType("bigint"); + + b.HasKey("ReviewRefId", "LeagueId", "TeamRefId"); + + b.HasIndex("LeagueId", "ReviewRefId"); + + b.HasIndex("LeagueId", "TeamRefId"); + + b.ToTable("IncidentReviewsInvolvedTeams"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IRSimSessionDetailsEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("SessionDetailsId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Category") + .HasColumnType("longtext"); + + b.Property("ConfigName") + .HasColumnType("longtext"); + + b.Property("CornersPerLap") + .HasColumnType("int"); + + b.Property("DamageModel") + .HasColumnType("int"); + + b.Property("EndTime") + .HasColumnType("datetime"); + + b.Property("EventAverageLap") + .HasColumnType("bigint"); + + b.Property("EventId") + .HasColumnType("bigint"); + + b.Property("EventLapsComplete") + .HasColumnType("int"); + + b.Property("EventStrengthOfField") + .HasColumnType("int"); + + b.Property("Fog") + .HasColumnType("int"); + + b.Property("IRRaceWeek") + .HasColumnType("int"); + + b.Property("IRSeasonId") + .HasColumnType("bigint"); + + b.Property("IRSeasonName") + .HasColumnType("longtext"); + + b.Property("IRSeasonQuarter") + .HasColumnType("int"); + + b.Property("IRSeasonYear") + .HasColumnType("int"); + + b.Property("IRSessionId") + .HasColumnType("bigint"); + + b.Property("IRSubsessionId") + .HasColumnType("bigint"); + + b.Property("IRTrackId") + .HasColumnType("int"); + + b.Property("KmDistPerLap") + .HasColumnType("double"); + + b.Property("LeaveMarbles") + .HasColumnType("tinyint(1)"); + + b.Property("LicenseCategory") + .HasColumnType("int"); + + b.Property("MaxWeeks") + .HasColumnType("int"); + + b.Property("NumCautionLaps") + .HasColumnType("int"); + + b.Property("NumCautions") + .HasColumnType("int"); + + b.Property("NumLeadChanges") + .HasColumnType("int"); + + b.Property("PracticeGripCompound") + .HasColumnType("int"); + + b.Property("PracticeRubber") + .HasColumnType("int"); + + b.Property("QualifyGripCompund") + .HasColumnType("int"); + + b.Property("QualifyRubber") + .HasColumnType("int"); + + b.Property("RaceGripCompound") + .HasColumnType("int"); + + b.Property("RaceRubber") + .HasColumnType("int"); + + b.Property("RelHumidity") + .HasColumnType("int"); + + b.Property("SessionName") + .HasColumnType("longtext"); + + b.Property("SimStartUtcOffset") + .HasColumnType("bigint"); + + b.Property("SimStartUtcTime") + .HasColumnType("datetime"); + + b.Property("Skies") + .HasColumnType("int"); + + b.Property("StartTime") + .HasColumnType("datetime"); + + b.Property("TempUnits") + .HasColumnType("int"); + + b.Property("TempValue") + .HasColumnType("int"); + + b.Property("TimeOfDay") + .HasColumnType("int"); + + b.Property("TrackCategoryId") + .HasColumnType("int"); + + b.Property("TrackName") + .HasColumnType("longtext"); + + b.Property("WarmupGripCompound") + .HasColumnType("int"); + + b.Property("WarmupRubber") + .HasColumnType("int"); + + b.Property("WeatherType") + .HasColumnType("int"); + + b.Property("WeatherVarInitial") + .HasColumnType("int"); + + b.Property("WeatherVarOngoing") + .HasColumnType("int"); + + b.Property("WindDir") + .HasColumnType("int"); + + b.Property("WindUnits") + .HasColumnType("int"); + + b.HasKey("LeagueId", "SessionDetailsId"); + + b.HasAlternateKey("SessionDetailsId"); + + b.HasIndex("LeagueId", "EventId"); + + b.ToTable("IRSimSessionDetails"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.LeagueEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DescriptionPlain") + .HasColumnType("longtext"); + + b.Property("EnableLiveReviews") + .HasColumnType("tinyint(1)"); + + b.Property("EnableProtests") + .HasColumnType("tinyint(1)"); + + b.Property("Expires") + .HasColumnType("datetime(6)"); + + b.Property("IsInitialized") + .HasColumnType("tinyint(1)"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime(6)"); + + b.Property("LeaguePublic") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(85) + .HasColumnType("varchar(85)"); + + b.Property("NameFull") + .HasColumnType("longtext"); + + b.Property("ProtestCoolDownPeriod") + .HasColumnType("bigint"); + + b.Property("ProtestFormAccess") + .HasColumnType("int"); + + b.Property("ProtestsClosedAfter") + .HasColumnType("bigint"); + + b.Property("ProtestsPublic") + .HasColumnType("int"); + + b.Property("Subscription") + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasAlternateKey("Name"); + + b.ToTable("Leagues"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.LeagueMemberEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("MemberId") + .HasColumnType("bigint"); + + b.Property("TeamId") + .HasColumnType("bigint"); + + b.HasKey("LeagueId", "MemberId"); + + b.HasIndex("MemberId"); + + b.HasIndex("LeagueId", "TeamId"); + + b.ToTable("LeagueMembers"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.MemberEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("DanLisaId") + .HasColumnType("longtext"); + + b.Property("DiscordId") + .HasColumnType("longtext"); + + b.Property("Firstname") + .HasColumnType("longtext"); + + b.Property("IRacingId") + .HasColumnType("longtext"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("Lastname") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Members"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.PaymentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("LastPaymentReceived") + .HasColumnType("datetime(6)"); + + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("NextPaymentDue") + .HasColumnType("datetime(6)"); + + b.Property("PlanId") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("SubscriptionId") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Type") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("LeagueId"); + + b.HasIndex("PlanId"); + + b.ToTable("Payments", (string)null); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.PointRuleEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("PointRuleId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("BonusPoints") + .IsRequired() + .HasColumnType("json"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("FinalSortOptions") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("MaxPoints") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("PointDropOff") + .HasColumnType("int"); + + b.Property("PointsPerPlace") + .HasColumnType("longtext"); + + b.Property("PointsSortOptions") + .HasColumnType("longtext"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "PointRuleId"); + + b.HasAlternateKey("PointRuleId"); + + b.ToTable("PointRules"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ProtestEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ProtestId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("AuthorMemberId") + .HasColumnType("bigint"); + + b.Property("Corner") + .HasColumnType("longtext"); + + b.Property("FullDescription") + .HasColumnType("longtext"); + + b.Property("OnLap") + .HasColumnType("longtext"); + + b.Property("SessionId") + .HasColumnType("bigint"); + + b.HasKey("LeagueId", "ProtestId"); + + b.HasAlternateKey("ProtestId"); + + b.HasIndex("LeagueId", "AuthorMemberId"); + + b.HasIndex("LeagueId", "SessionId"); + + b.ToTable("Protests", (string)null); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.Protests_LeagueMembers", b => + { + b.Property("MemberId") + .HasColumnType("bigint"); + + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ProtestId") + .HasColumnType("bigint"); + + b.HasKey("MemberId", "LeagueId", "ProtestId"); + + b.HasIndex("LeagueId", "MemberId"); + + b.HasIndex("LeagueId", "ProtestId"); + + b.ToTable("Protests_LeagueMembers"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ResultConfigId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ChampSeasonId") + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("DisplayName") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("ResultsPerTeam") + .HasColumnType("int"); + + b.Property("SourceResultConfigId") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "ResultConfigId"); + + b.HasAlternateKey("ResultConfigId"); + + b.HasIndex("LeagueId", "ChampSeasonId"); + + b.HasIndex("LeagueId", "SourceResultConfigId"); + + b.ToTable("ResultConfigurations"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ResultRowEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ResultRowId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("AvgLapTime") + .HasColumnType("bigint"); + + b.Property("Car") + .HasColumnType("longtext"); + + b.Property("CarClass") + .HasColumnType("longtext"); + + b.Property("CarId") + .HasColumnType("int"); + + b.Property("CarNumber") + .HasColumnType("int"); + + b.Property("ClassId") + .HasColumnType("int"); + + b.Property("ClubId") + .HasColumnType("int"); + + b.Property("ClubName") + .HasColumnType("longtext"); + + b.Property("CompletedLaps") + .HasColumnType("double"); + + b.Property("CompletedPct") + .HasColumnType("double"); + + b.Property("ContactLaps") + .HasColumnType("longtext"); + + b.Property("Division") + .HasColumnType("int"); + + b.Property("FastLapNr") + .HasColumnType("int"); + + b.Property("FastestLapTime") + .HasColumnType("bigint"); + + b.Property("FinishPosition") + .HasColumnType("double"); + + b.Property("IRacingId") + .HasColumnType("longtext"); + + b.Property("Incidents") + .HasColumnType("double"); + + b.Property("Interval") + .HasColumnType("bigint"); + + b.Property("LeadLaps") + .HasColumnType("double"); + + b.Property("License") + .HasColumnType("longtext"); + + b.Property("MemberId") + .HasColumnType("bigint"); + + b.Property("NewCpi") + .HasColumnType("int"); + + b.Property("NewIRating") + .HasColumnType("int"); + + b.Property("NewLicenseLevel") + .HasColumnType("int"); + + b.Property("NewSafetyRating") + .HasColumnType("double"); + + b.Property("NumContactLaps") + .HasColumnType("int"); + + b.Property("NumOfftrackLaps") + .HasColumnType("int"); + + b.Property("NumPitStops") + .HasColumnType("int"); + + b.Property("OfftrackLaps") + .HasColumnType("longtext"); + + b.Property("OldCpi") + .HasColumnType("int"); + + b.Property("OldIRating") + .HasColumnType("int"); + + b.Property("OldLicenseLevel") + .HasColumnType("int"); + + b.Property("OldSafetyRating") + .HasColumnType("double"); + + b.Property("PittedLaps") + .HasColumnType("longtext"); + + b.Property("PointsEligible") + .HasColumnType("tinyint(1)"); + + b.Property("PositionChange") + .HasColumnType("double"); + + b.Property("QualifyingTime") + .HasColumnType("bigint"); + + b.Property("QualifyingTimeAt") + .HasColumnType("datetime"); + + b.Property("RacePoints") + .HasColumnType("double"); + + b.Property("SeasonStartIRating") + .HasColumnType("int"); + + b.Property("SimSessionType") + .HasColumnType("int"); + + b.Property("StartPosition") + .HasColumnType("double"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("SubSessionId") + .HasColumnType("bigint"); + + b.Property("TeamId") + .HasColumnType("bigint"); + + b.HasKey("LeagueId", "ResultRowId"); + + b.HasAlternateKey("ResultRowId"); + + b.HasIndex("MemberId"); + + b.HasIndex("LeagueId", "MemberId"); + + b.HasIndex("LeagueId", "SubSessionId"); + + b.HasIndex("LeagueId", "TeamId"); + + b.ToTable("ResultRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ReviewCommentEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("CommentId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("AuthorName") + .HasColumnType("longtext"); + + b.Property("AuthorUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("Date") + .HasColumnType("datetime"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("ReplyToCommentId") + .HasColumnType("bigint"); + + b.Property("ReviewId") + .HasColumnType("bigint"); + + b.Property("Text") + .HasColumnType("longtext"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "CommentId"); + + b.HasAlternateKey("CommentId"); + + b.HasIndex("ReplyToCommentId"); + + b.HasIndex("ReviewId"); + + b.HasIndex("LeagueId", "ReplyToCommentId"); + + b.HasIndex("LeagueId", "ReviewId"); + + b.ToTable("ReviewComments"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ReviewCommentVoteEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ReviewVoteId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CommentId") + .HasColumnType("bigint"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("MemberAtFaultId") + .HasColumnType("bigint"); + + b.Property("TeamAtFaultId") + .HasColumnType("bigint"); + + b.Property("VoteCategoryId") + .HasColumnType("bigint"); + + b.HasKey("LeagueId", "ReviewVoteId"); + + b.HasAlternateKey("ReviewVoteId"); + + b.HasIndex("CommentId"); + + b.HasIndex("MemberAtFaultId"); + + b.HasIndex("VoteCategoryId"); + + b.HasIndex("LeagueId", "CommentId"); + + b.HasIndex("LeagueId", "TeamAtFaultId"); + + b.HasIndex("LeagueId", "VoteCategoryId"); + + b.ToTable("ReviewCommentVotes"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ReviewPenaltyEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ResultRowId") + .HasColumnType("bigint"); + + b.Property("ReviewId") + .HasColumnType("bigint"); + + b.Property("ReviewVoteId") + .HasColumnType("bigint"); + + b.Property("Value") + .HasColumnType("json"); + + b.HasKey("LeagueId", "ResultRowId", "ReviewId", "ReviewVoteId"); + + b.HasIndex("ReviewId"); + + b.HasIndex("ReviewVoteId"); + + b.HasIndex("LeagueId", "ResultRowId"); + + b.HasIndex("LeagueId", "ReviewId"); + + b.HasIndex("LeagueId", "ReviewVoteId"); + + b.ToTable("ReviewPenaltys"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScheduleEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ScheduleId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("SeasonId") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "ScheduleId"); + + b.HasAlternateKey("ScheduleId"); + + b.HasIndex("LeagueId", "SeasonId"); + + b.ToTable("Schedules"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredEventResultEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ResultId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ChampSeasonId") + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("EventId") + .HasColumnType("bigint"); + + b.Property("EventResultEntityEventId") + .HasColumnType("bigint"); + + b.Property("EventResultEntityLeagueId") + .HasColumnType("bigint"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("ResultConfigId") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "ResultId"); + + b.HasAlternateKey("ResultId"); + + b.HasIndex("EventResultEntityLeagueId", "EventResultEntityEventId"); + + b.HasIndex("LeagueId", "ChampSeasonId"); + + b.HasIndex("LeagueId", "EventId"); + + b.HasIndex("LeagueId", "ResultConfigId"); + + b.ToTable("ScoredEventResults"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ScoredResultRowId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("AvgLapTime") + .HasColumnType("bigint"); + + b.Property("BonusPoints") + .HasColumnType("double"); + + b.Property("Car") + .HasColumnType("longtext"); + + b.Property("CarClass") + .HasColumnType("longtext"); + + b.Property("CarId") + .HasColumnType("int"); + + b.Property("CarNumber") + .HasColumnType("int"); + + b.Property("ClassId") + .HasColumnType("int"); + + b.Property("ClubId") + .HasColumnType("int"); + + b.Property("ClubName") + .HasColumnType("longtext"); + + b.Property("CompletedLaps") + .HasColumnType("double"); + + b.Property("CompletedPct") + .HasColumnType("double"); + + b.Property("ContactLaps") + .HasColumnType("longtext"); + + b.Property("Division") + .HasColumnType("int"); + + b.Property("FastLapNr") + .HasColumnType("int"); + + b.Property("FastestLapTime") + .HasColumnType("bigint"); + + b.Property("FinalPosition") + .HasColumnType("int"); + + b.Property("FinalPositionChange") + .HasColumnType("double"); + + b.Property("FinishPosition") + .HasColumnType("double"); + + b.Property("IRacingId") + .HasColumnType("longtext"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("Incidents") + .HasColumnType("double"); + + b.Property("Interval") + .HasColumnType("bigint"); + + b.Property("LeadLaps") + .HasColumnType("double"); + + b.Property("License") + .HasColumnType("longtext"); + + b.Property("MemberId") + .HasColumnType("bigint"); + + b.Property("NewCpi") + .HasColumnType("int"); + + b.Property("NewIRating") + .HasColumnType("int"); + + b.Property("NewLicenseLevel") + .HasColumnType("int"); + + b.Property("NewSafetyRating") + .HasColumnType("double"); + + b.Property("NumContactLaps") + .HasColumnType("int"); + + b.Property("NumOfftrackLaps") + .HasColumnType("int"); + + b.Property("NumPitStops") + .HasColumnType("int"); + + b.Property("OfftrackLaps") + .HasColumnType("longtext"); + + b.Property("OldCpi") + .HasColumnType("int"); + + b.Property("OldIRating") + .HasColumnType("int"); + + b.Property("OldLicenseLevel") + .HasColumnType("int"); + + b.Property("OldSafetyRating") + .HasColumnType("double"); + + b.Property("PenaltyPoints") + .HasColumnType("double"); + + b.Property("PittedLaps") + .HasColumnType("longtext"); + + b.Property("PointsEligible") + .HasColumnType("tinyint(1)"); + + b.Property("PositionChange") + .HasColumnType("double"); + + b.Property("QualifyingTime") + .HasColumnType("bigint"); + + b.Property("QualifyingTimeAt") + .HasColumnType("datetime"); + + b.Property("RacePoints") + .HasColumnType("double"); + + b.Property("SeasonStartIRating") + .HasColumnType("int"); + + b.Property("SessionResultId") + .HasColumnType("bigint"); + + b.Property("SimSessionType") + .HasColumnType("int"); + + b.Property("StartPosition") + .HasColumnType("double"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("TeamId") + .HasColumnType("bigint"); + + b.Property("TotalPoints") + .HasColumnType("double"); + + b.HasKey("LeagueId", "ScoredResultRowId"); + + b.HasAlternateKey("ScoredResultRowId"); + + b.HasIndex("MemberId"); + + b.HasIndex("TeamId"); + + b.HasIndex("LeagueId", "SessionResultId"); + + b.HasIndex("LeagueId", "TeamId"); + + b.ToTable("ScoredResultRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredSessionResultEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("SessionResultId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("Discriminator") + .HasColumnType("longtext"); + + b.Property("FastestAvgLap") + .HasColumnType("bigint"); + + b.Property("FastestAvgLapDriverMemberId") + .HasColumnType("bigint"); + + b.Property("FastestLap") + .HasColumnType("bigint"); + + b.Property("FastestLapDriverMemberId") + .HasColumnType("bigint"); + + b.Property("FastestQualyLap") + .HasColumnType("bigint"); + + b.Property("FastestQualyLapDriverMemberId") + .HasColumnType("bigint"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("ResultId") + .HasColumnType("bigint"); + + b.Property("ScoringId") + .HasColumnType("bigint"); + + b.Property("SessionNr") + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "SessionResultId"); + + b.HasAlternateKey("SessionResultId"); + + b.HasIndex("FastestAvgLapDriverMemberId"); + + b.HasIndex("FastestLapDriverMemberId"); + + b.HasIndex("FastestQualyLapDriverMemberId"); + + b.HasIndex("LeagueId", "ResultId"); + + b.HasIndex("LeagueId", "ScoringId"); + + b.ToTable("ScoredSessionResults"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredTeamResultRowsResultRows", b => + { + b.Property("TeamParentRowRefId") + .HasColumnType("bigint"); + + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("TeamResultRowRefId") + .HasColumnType("bigint"); + + b.HasKey("TeamParentRowRefId", "LeagueId", "TeamResultRowRefId"); + + b.HasIndex("LeagueId", "TeamParentRowRefId"); + + b.HasIndex("LeagueId", "TeamResultRowRefId"); + + b.ToTable("ScoredTeamResultRowsResultRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoringEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ScoringId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("ExtScoringSourceId") + .HasColumnType("bigint"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("IsCombinedResult") + .HasColumnType("tinyint(1)"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("MaxResultsPerGroup") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("PointsRuleId") + .HasColumnType("bigint"); + + b.Property("ResultConfigId") + .HasColumnType("bigint"); + + b.Property("ScheduleEntityLeagueId") + .HasColumnType("bigint"); + + b.Property("ScheduleEntityScheduleId") + .HasColumnType("bigint"); + + b.Property("ShowResults") + .HasColumnType("tinyint(1)"); + + b.Property("UpdateTeamOnRecalculation") + .HasColumnType("tinyint(1)"); + + b.Property("UseExternalSourcePoints") + .HasColumnType("tinyint(1)"); + + b.Property("UseResultSetTeam") + .HasColumnType("tinyint(1)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "ScoringId"); + + b.HasAlternateKey("ScoringId"); + + b.HasIndex("ExtScoringSourceId"); + + b.HasIndex("LeagueId", "ExtScoringSourceId"); + + b.HasIndex("LeagueId", "PointsRuleId"); + + b.HasIndex("LeagueId", "ResultConfigId"); + + b.HasIndex("ScheduleEntityLeagueId", "ScheduleEntityScheduleId"); + + b.ToTable("Scorings"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SeasonEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("SeasonId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("Finished") + .HasColumnType("tinyint(1)"); + + b.Property("HideCommentsBeforeVoted") + .HasColumnType("tinyint(1)"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("MainScoringLeagueId") + .HasColumnType("bigint"); + + b.Property("MainScoringScoringId") + .HasColumnType("bigint"); + + b.Property("SeasonEnd") + .HasColumnType("datetime"); + + b.Property("SeasonName") + .HasColumnType("longtext"); + + b.Property("SeasonStart") + .HasColumnType("datetime"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "SeasonId"); + + b.HasAlternateKey("SeasonId"); + + b.HasIndex("MainScoringLeagueId", "MainScoringScoringId"); + + b.ToTable("Seasons"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SessionEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("SessionId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("Duration") + .HasColumnType("bigint"); + + b.Property("EventId") + .HasColumnType("bigint"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("Laps") + .HasColumnType("int"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("SessionNr") + .HasColumnType("int"); + + b.Property("SessionType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartOffset") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "SessionId"); + + b.HasAlternateKey("SessionId"); + + b.HasIndex("EventId", "SessionId"); + + b.HasIndex("LeagueId", "EventId"); + + b.ToTable("Sessions"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SessionResultEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("SessionId") + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime(6)"); + + b.Property("EventId") + .HasColumnType("bigint"); + + b.Property("IRSimSessionDetailsId") + .HasColumnType("bigint"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime(6)"); + + b.Property("SimSessionType") + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "SessionId"); + + b.HasIndex("SessionId"); + + b.HasIndex("LeagueId", "EventId"); + + b.HasIndex("LeagueId", "IRSimSessionDetailsId"); + + b.ToTable("SessionResults"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingConfigurationEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("StandingConfigId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime(6)"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("ResultKind") + .HasColumnType("int"); + + b.Property("SortOptions") + .HasColumnType("longtext"); + + b.Property("UseCombinedResult") + .HasColumnType("tinyint(1)"); + + b.Property("Version") + .HasColumnType("int"); + + b.Property("WeeksCounted") + .HasColumnType("int"); + + b.HasKey("LeagueId", "StandingConfigId"); + + b.HasAlternateKey("StandingConfigId"); + + b.ToTable("StandingConfigurations"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("StandingId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ChampSeasonId") + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime(6)"); + + b.Property("EventId") + .HasColumnType("bigint"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("IsTeamStanding") + .HasColumnType("tinyint(1)"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("SeasonId") + .HasColumnType("bigint"); + + b.Property("StandingConfigId") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "StandingId"); + + b.HasAlternateKey("StandingId"); + + b.HasIndex("LeagueId", "ChampSeasonId"); + + b.HasIndex("LeagueId", "EventId"); + + b.HasIndex("LeagueId", "SeasonId"); + + b.HasIndex("LeagueId", "StandingConfigId"); + + b.ToTable("Standings"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingRowEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("StandingRowId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CarClass") + .HasColumnType("longtext"); + + b.Property("ClassId") + .HasColumnType("int"); + + b.Property("CompletedLaps") + .HasColumnType("int"); + + b.Property("CompletedLapsChange") + .HasColumnType("int"); + + b.Property("DroppedResultCount") + .HasColumnType("int"); + + b.Property("FastestLaps") + .HasColumnType("int"); + + b.Property("FastestLapsChange") + .HasColumnType("int"); + + b.Property("Incidents") + .HasColumnType("int"); + + b.Property("IncidentsChange") + .HasColumnType("int"); + + b.Property("LastIrating") + .HasColumnType("int"); + + b.Property("LastPosition") + .HasColumnType("int"); + + b.Property("LeadLaps") + .HasColumnType("int"); + + b.Property("LeadLapsChange") + .HasColumnType("int"); + + b.Property("MemberId") + .HasColumnType("bigint"); + + b.Property("PenaltyPoints") + .HasColumnType("int"); + + b.Property("PenaltyPointsChange") + .HasColumnType("int"); + + b.Property("PolePositions") + .HasColumnType("int"); + + b.Property("PolePositionsChange") + .HasColumnType("int"); + + b.Property("Position") + .HasColumnType("int"); + + b.Property("PositionChange") + .HasColumnType("int"); + + b.Property("RacePoints") + .HasColumnType("int"); + + b.Property("RacePointsChange") + .HasColumnType("int"); + + b.Property("Races") + .HasColumnType("int"); + + b.Property("RacesCounted") + .HasColumnType("int"); + + b.Property("RacesInPoints") + .HasColumnType("int"); + + b.Property("RacesScored") + .HasColumnType("int"); + + b.Property("StandingId") + .HasColumnType("bigint"); + + b.Property("StartIrating") + .HasColumnType("int"); + + b.Property("TeamId") + .HasColumnType("bigint"); + + b.Property("Top10") + .HasColumnType("int"); + + b.Property("Top3") + .HasColumnType("int"); + + b.Property("Top5") + .HasColumnType("int"); + + b.Property("TotalPoints") + .HasColumnType("int"); + + b.Property("TotalPointsChange") + .HasColumnType("int"); + + b.Property("Wins") + .HasColumnType("int"); + + b.Property("WinsChange") + .HasColumnType("int"); + + b.HasKey("LeagueId", "StandingRowId"); + + b.HasAlternateKey("StandingRowId"); + + b.HasIndex("MemberId"); + + b.HasIndex("LeagueId", "StandingId"); + + b.HasIndex("LeagueId", "TeamId"); + + b.ToTable("StandingRows", (string)null); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingRows_ScoredResultRows", b => + { + b.Property("ScoredResultRowRefId") + .HasColumnType("bigint"); + + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("StandingRowRefId") + .HasColumnType("bigint"); + + b.Property("IsScored") + .HasColumnType("tinyint(1)"); + + b.HasKey("ScoredResultRowRefId", "LeagueId", "StandingRowRefId"); + + b.HasIndex("LeagueId", "ScoredResultRowRefId"); + + b.HasIndex("LeagueId", "StandingRowRefId"); + + b.ToTable("StandingRows_ScoredResultRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StatisticSetEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("CurrentChampId") + .HasColumnType("bigint"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FinishedRaces") + .HasColumnType("int"); + + b.Property("FirstDate") + .HasColumnType("datetime"); + + b.Property("ImportSource") + .HasColumnType("longtext"); + + b.Property("IsSeasonFinished") + .HasColumnType("tinyint(1)"); + + b.Property("LastDate") + .HasColumnType("datetime"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("RequiresRecalculation") + .HasColumnType("tinyint(1)"); + + b.Property("SeasonId") + .HasColumnType("bigint"); + + b.Property("StandingId") + .HasColumnType("bigint"); + + b.Property("UpdateInterval") + .HasColumnType("bigint"); + + b.Property("UpdateTime") + .HasColumnType("datetime"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "Id"); + + b.HasAlternateKey("Id"); + + b.HasIndex("CurrentChampId"); + + b.HasIndex("LeagueId", "SeasonId"); + + b.HasIndex("LeagueId", "StandingId"); + + b.ToTable("StatisticSets"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SubscriptionEntity", b => + { + b.Property("PlanId") + .HasColumnType("varchar(255)"); + + b.Property("Interval") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Price") + .HasColumnType("double"); + + b.HasKey("PlanId"); + + b.ToTable("Subscriptions", (string)null); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.TeamEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("TeamId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("IRacingTeamId") + .HasColumnType("bigint"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("Profile") + .HasColumnType("longtext"); + + b.Property("TeamColor") + .HasColumnType("longtext"); + + b.Property("TeamHomepage") + .HasColumnType("longtext"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "TeamId"); + + b.HasAlternateKey("TeamId"); + + b.ToTable("Teams"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.TrackConfigEntity", b => + { + b.Property("TrackId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ConfigName") + .HasColumnType("longtext"); + + b.Property("ConfigType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("HasNightLighting") + .HasColumnType("tinyint(1)"); + + b.Property("LegacyTrackId") + .HasColumnType("longtext"); + + b.Property("LengthKm") + .HasColumnType("double"); + + b.Property("TrackGroupId") + .HasColumnType("bigint"); + + b.Property("Turns") + .HasColumnType("int"); + + b.HasKey("TrackId"); + + b.HasIndex("TrackGroupId"); + + b.ToTable("TrackConfigs"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.TrackGroupEntity", b => + { + b.Property("TrackGroupId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Location") + .HasColumnType("longtext"); + + b.Property("TrackName") + .HasColumnType("longtext"); + + b.HasKey("TrackGroupId"); + + b.ToTable("TrackGroups"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.VoteCategoryEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("CatId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("DefaultPenalty") + .HasColumnType("int"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("Text") + .HasColumnType("longtext"); + + b.HasKey("LeagueId", "CatId"); + + b.HasAlternateKey("CatId"); + + b.ToTable("VoteCategories"); + }); + + modelBuilder.Entity("MemberEntityScoredSessionResultEntity", b => + { + b.Property("CleanestDriversId") + .HasColumnType("bigint"); + + b.Property("CleanestDriverResultsLeagueId") + .HasColumnType("bigint"); + + b.Property("CleanestDriverResultsSessionResultId") + .HasColumnType("bigint"); + + b.HasKey("CleanestDriversId", "CleanestDriverResultsLeagueId", "CleanestDriverResultsSessionResultId"); + + b.HasIndex("CleanestDriverResultsLeagueId", "CleanestDriverResultsSessionResultId"); + + b.ToTable("ScoredResultsCleanestDrivers", (string)null); + }); + + modelBuilder.Entity("MemberEntityScoredSessionResultEntity1", b => + { + b.Property("HardChargersId") + .HasColumnType("bigint"); + + b.Property("HardChargerResultsLeagueId") + .HasColumnType("bigint"); + + b.Property("HardChargerResultsSessionResultId") + .HasColumnType("bigint"); + + b.HasKey("HardChargersId", "HardChargerResultsLeagueId", "HardChargerResultsSessionResultId"); + + b.HasIndex("HardChargerResultsLeagueId", "HardChargerResultsSessionResultId"); + + b.ToTable("ScoredResultsHardChargers", (string)null); + }); + + modelBuilder.Entity("StatisticSetEntityStatisticSetEntity", b => + { + b.Property("DependendStatisticSetsLeagueId") + .HasColumnType("bigint"); + + b.Property("DependendStatisticSetsId") + .HasColumnType("bigint"); + + b.Property("LeagueStatisticSetsLeagueId") + .HasColumnType("bigint"); + + b.Property("LeagueStatisticSetsId") + .HasColumnType("bigint"); + + b.HasKey("DependendStatisticSetsLeagueId", "DependendStatisticSetsId", "LeagueStatisticSetsLeagueId", "LeagueStatisticSetsId"); + + b.HasIndex("LeagueStatisticSetsLeagueId", "LeagueStatisticSetsId"); + + b.ToTable("LeagueStatisticSetsStatisticSets", (string)null); + }); + + modelBuilder.Entity("IncidentReviewEntityMemberEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", null) + .WithMany() + .HasForeignKey("InvolvedMembersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.IncidentReviewEntity", null) + .WithMany() + .HasForeignKey("InvolvedReviewsLeagueId", "InvolvedReviewsReviewId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.AcceptedReviewVoteEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "MemberAtFault") + .WithMany("AcceptedReviewVotes") + .HasForeignKey("MemberAtFaultId"); + + b.HasOne("iRLeagueDatabaseCore.Models.IncidentReviewEntity", "Review") + .WithMany("AcceptedReviewVotes") + .HasForeignKey("LeagueId", "ReviewId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.TeamEntity", "TeamAtFault") + .WithMany() + .HasForeignKey("LeagueId", "TeamAtFaultId"); + + b.HasOne("iRLeagueDatabaseCore.Models.VoteCategoryEntity", "VoteCategory") + .WithMany("AcceptedReviewVotes") + .HasForeignKey("LeagueId", "VoteCategoryId"); + + b.Navigation("MemberAtFault"); + + b.Navigation("Review"); + + b.Navigation("TeamAtFault"); + + b.Navigation("VoteCategory"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.AddPenaltyEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", "ScoredResultRow") + .WithMany("AddPenalties") + .HasForeignKey("LeagueId", "ScoredResultRowId") + .OnDelete(DeleteBehavior.ClientCascade) + .IsRequired(); + + b.Navigation("ScoredResultRow"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.AutoPenaltyConfigEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.PointRuleEntity", "PointRule") + .WithMany("AutoPenalties") + .HasForeignKey("LeagueId", "PointRuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PointRule"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ChampionshipEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("Championships") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("League"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ChampSeasonEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.ChampionshipEntity", "Championship") + .WithMany("ChampSeasons") + .HasForeignKey("LeagueId", "ChampionshipId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", "DefaultResultConfig") + .WithMany() + .HasForeignKey("LeagueId", "DefaultResultConfigId"); + + b.HasOne("iRLeagueDatabaseCore.Models.SeasonEntity", "Season") + .WithMany("ChampSeasons") + .HasForeignKey("LeagueId", "SeasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.StandingConfigurationEntity", "StandingConfiguration") + .WithMany("ChampSeasons") + .HasForeignKey("LeagueId", "StandingConfigId"); + + b.Navigation("Championship"); + + b.Navigation("DefaultResultConfig"); + + b.Navigation("Season"); + + b.Navigation("StandingConfiguration"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.CustomIncidentEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany() + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("League"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.DriverStatisticRowEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "Member") + .WithMany("DriverStatisticRows") + .HasForeignKey("MemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.SessionEntity", "FirstRace") + .WithMany() + .HasForeignKey("LeagueId", "FirstRaceId"); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", "FirstResultRow") + .WithMany() + .HasForeignKey("LeagueId", "FirstResultRowId"); + + b.HasOne("iRLeagueDatabaseCore.Models.SessionEntity", "FirstSession") + .WithMany() + .HasForeignKey("LeagueId", "FirstSessionId"); + + b.HasOne("iRLeagueDatabaseCore.Models.SessionEntity", "LastRace") + .WithMany() + .HasForeignKey("LeagueId", "LastRaceId"); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", "LastResultRow") + .WithMany() + .HasForeignKey("LeagueId", "LastResultRowId"); + + b.HasOne("iRLeagueDatabaseCore.Models.SessionEntity", "LastSession") + .WithMany() + .HasForeignKey("LeagueId", "LastSessionId"); + + b.HasOne("iRLeagueDatabaseCore.Models.StatisticSetEntity", "StatisticSet") + .WithMany("DriverStatisticRows") + .HasForeignKey("LeagueId", "StatisticSetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FirstRace"); + + b.Navigation("FirstResultRow"); + + b.Navigation("FirstSession"); + + b.Navigation("LastRace"); + + b.Navigation("LastResultRow"); + + b.Navigation("LastSession"); + + b.Navigation("Member"); + + b.Navigation("StatisticSet"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.EventEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.TrackConfigEntity", "Track") + .WithMany() + .HasForeignKey("TrackId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("iRLeagueDatabaseCore.Models.ScheduleEntity", "Schedule") + .WithMany("Events") + .HasForeignKey("LeagueId", "ScheduleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Schedule"); + + b.Navigation("Track"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.EventResultConfigs", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.EventEntity", "Event") + .WithMany() + .HasForeignKey("LeagueId", "EventRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", "ResultConfig") + .WithMany() + .HasForeignKey("LeagueId", "ResultConfigRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Event"); + + b.Navigation("ResultConfig"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.EventResultEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.EventEntity", "Event") + .WithOne("EventResult") + .HasForeignKey("iRLeagueDatabaseCore.Models.EventResultEntity", "LeagueId", "EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Event"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.FilterOptionEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.ChampSeasonEntity", "ChampSeason") + .WithMany("Filters") + .HasForeignKey("LeagueId", "ChampSeasonId") + .OnDelete(DeleteBehavior.ClientCascade); + + b.HasOne("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", "PointFilterResultConfig") + .WithMany("PointFilters") + .HasForeignKey("LeagueId", "PointFilterResultConfigId") + .OnDelete(DeleteBehavior.ClientCascade); + + b.HasOne("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", "ResultFilterResultConfig") + .WithMany("ResultFilters") + .HasForeignKey("LeagueId", "ResultFilterResultConfigId") + .OnDelete(DeleteBehavior.ClientCascade); + + b.Navigation("ChampSeason"); + + b.Navigation("PointFilterResultConfig"); + + b.Navigation("ResultFilterResultConfig"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IncidentReviewEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.SessionEntity", "Session") + .WithMany("IncidentReviews") + .HasForeignKey("LeagueId", "SessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Session"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IncidentReviewsInvolvedTeams", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.IncidentReviewEntity", "Review") + .WithMany() + .HasForeignKey("LeagueId", "ReviewRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.TeamEntity", "Team") + .WithMany() + .HasForeignKey("LeagueId", "TeamRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Review"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IRSimSessionDetailsEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.EventEntity", "Event") + .WithMany("SimSessionDetails") + .HasForeignKey("LeagueId", "EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Event"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.LeagueMemberEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("LeagueMembers") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "Member") + .WithMany() + .HasForeignKey("MemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.TeamEntity", "Team") + .WithMany("Members") + .HasForeignKey("LeagueId", "TeamId"); + + b.Navigation("League"); + + b.Navigation("Member"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.PaymentEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("Payments") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.SubscriptionEntity", "Subscription") + .WithMany("Payments") + .HasForeignKey("PlanId"); + + b.Navigation("League"); + + b.Navigation("Subscription"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.PointRuleEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("PointRules") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("League"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ProtestEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueMemberEntity", "Author") + .WithMany() + .HasForeignKey("LeagueId", "AuthorMemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.SessionEntity", "Session") + .WithMany() + .HasForeignKey("LeagueId", "SessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Session"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.Protests_LeagueMembers", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueMemberEntity", "Member") + .WithMany() + .HasForeignKey("LeagueId", "MemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ProtestEntity", "Protest") + .WithMany() + .HasForeignKey("LeagueId", "ProtestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Member"); + + b.Navigation("Protest"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("ResultConfigs") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ChampSeasonEntity", "ChampSeason") + .WithMany("ResultConfigurations") + .HasForeignKey("LeagueId", "ChampSeasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", "SourceResultConfig") + .WithMany() + .HasForeignKey("LeagueId", "SourceResultConfigId"); + + b.Navigation("ChampSeason"); + + b.Navigation("League"); + + b.Navigation("SourceResultConfig"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ResultRowEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "Member") + .WithMany("ResultRows") + .HasForeignKey("MemberId") + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.LeagueMemberEntity", "LeagueMember") + .WithMany() + .HasForeignKey("LeagueId", "MemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.SessionResultEntity", "SubResult") + .WithMany("ResultRows") + .HasForeignKey("LeagueId", "SubSessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.TeamEntity", "Team") + .WithMany() + .HasForeignKey("LeagueId", "TeamId"); + + b.Navigation("LeagueMember"); + + b.Navigation("Member"); + + b.Navigation("SubResult"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ReviewCommentEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.ReviewCommentEntity", "ReplyToComment") + .WithMany("Replies") + .HasForeignKey("LeagueId", "ReplyToCommentId"); + + b.HasOne("iRLeagueDatabaseCore.Models.IncidentReviewEntity", "Review") + .WithMany("Comments") + .HasForeignKey("LeagueId", "ReviewId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("ReplyToComment"); + + b.Navigation("Review"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ReviewCommentVoteEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "MemberAtFault") + .WithMany("CommentReviewVotes") + .HasForeignKey("MemberAtFaultId"); + + b.HasOne("iRLeagueDatabaseCore.Models.ReviewCommentEntity", "Comment") + .WithMany("ReviewCommentVotes") + .HasForeignKey("LeagueId", "CommentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.TeamEntity", "TeamAtFault") + .WithMany() + .HasForeignKey("LeagueId", "TeamAtFaultId"); + + b.HasOne("iRLeagueDatabaseCore.Models.VoteCategoryEntity", "VoteCategory") + .WithMany("CommentReviewVotes") + .HasForeignKey("LeagueId", "VoteCategoryId"); + + b.Navigation("Comment"); + + b.Navigation("MemberAtFault"); + + b.Navigation("TeamAtFault"); + + b.Navigation("VoteCategory"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ReviewPenaltyEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", "ResultRow") + .WithMany("ReviewPenalties") + .HasForeignKey("LeagueId", "ResultRowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.IncidentReviewEntity", "Review") + .WithMany("ReviewPenaltys") + .HasForeignKey("LeagueId", "ReviewId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.AcceptedReviewVoteEntity", "ReviewVote") + .WithMany("ReviewPenaltys") + .HasForeignKey("LeagueId", "ReviewVoteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ResultRow"); + + b.Navigation("Review"); + + b.Navigation("ReviewVote"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScheduleEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.SeasonEntity", "Season") + .WithMany("Schedules") + .HasForeignKey("LeagueId", "SeasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Season"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredEventResultEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.EventResultEntity", null) + .WithMany("ScoredResults") + .HasForeignKey("EventResultEntityLeagueId", "EventResultEntityEventId"); + + b.HasOne("iRLeagueDatabaseCore.Models.ChampSeasonEntity", "ChampSeason") + .WithMany("EventResults") + .HasForeignKey("LeagueId", "ChampSeasonId"); + + b.HasOne("iRLeagueDatabaseCore.Models.EventEntity", "Event") + .WithMany("ScoredEventResults") + .HasForeignKey("LeagueId", "EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", "ResultConfig") + .WithMany() + .HasForeignKey("LeagueId", "ResultConfigId"); + + b.Navigation("ChampSeason"); + + b.Navigation("Event"); + + b.Navigation("ResultConfig"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "Member") + .WithMany() + .HasForeignKey("MemberId"); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoredSessionResultEntity", "ScoredSessionResult") + .WithMany("ScoredResultRows") + .HasForeignKey("LeagueId", "SessionResultId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.TeamEntity", "Team") + .WithMany() + .HasForeignKey("LeagueId", "TeamId"); + + b.Navigation("Member"); + + b.Navigation("ScoredSessionResult"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredSessionResultEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "FastestAvgLapDriver") + .WithMany("FastestAvgLapResults") + .HasForeignKey("FastestAvgLapDriverMemberId"); + + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "FastestLapDriver") + .WithMany("FastestLapResults") + .HasForeignKey("FastestLapDriverMemberId"); + + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "FastestQualyLapDriver") + .WithMany("FastestQualyLapResults") + .HasForeignKey("FastestQualyLapDriverMemberId"); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoredEventResultEntity", "ScoredEventResult") + .WithMany("ScoredSessionResults") + .HasForeignKey("LeagueId", "ResultId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoringEntity", "Scoring") + .WithMany() + .HasForeignKey("LeagueId", "ScoringId"); + + b.Navigation("FastestAvgLapDriver"); + + b.Navigation("FastestLapDriver"); + + b.Navigation("FastestQualyLapDriver"); + + b.Navigation("ScoredEventResult"); + + b.Navigation("Scoring"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredTeamResultRowsResultRows", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", "TeamParentRow") + .WithMany() + .HasForeignKey("LeagueId", "TeamParentRowRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", "TeamResultRow") + .WithMany() + .HasForeignKey("LeagueId", "TeamResultRowRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_ScoredTeamResultRowsResultRows_ScoredResultRows_LeagueId_Te~1"); + + b.Navigation("TeamParentRow"); + + b.Navigation("TeamResultRow"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoringEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", null) + .WithMany("Scorings") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoringEntity", "ExtScoringSource") + .WithMany("DependendScorings") + .HasForeignKey("LeagueId", "ExtScoringSourceId"); + + b.HasOne("iRLeagueDatabaseCore.Models.PointRuleEntity", "PointsRule") + .WithMany("Scorings") + .HasForeignKey("LeagueId", "PointsRuleId"); + + b.HasOne("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", "ResultConfiguration") + .WithMany("Scorings") + .HasForeignKey("LeagueId", "ResultConfigId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ScheduleEntity", null) + .WithMany("Scorings") + .HasForeignKey("ScheduleEntityLeagueId", "ScheduleEntityScheduleId"); + + b.Navigation("ExtScoringSource"); + + b.Navigation("PointsRule"); + + b.Navigation("ResultConfiguration"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SeasonEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("Seasons") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoringEntity", "MainScoring") + .WithMany() + .HasForeignKey("MainScoringLeagueId", "MainScoringScoringId"); + + b.Navigation("League"); + + b.Navigation("MainScoring"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SessionEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.EventEntity", "Event") + .WithMany("Sessions") + .HasForeignKey("LeagueId", "EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Event"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SessionResultEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.EventResultEntity", "Result") + .WithMany("SessionResults") + .HasForeignKey("LeagueId", "EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.IRSimSessionDetailsEntity", "IRSimSessionDetails") + .WithMany() + .HasForeignKey("LeagueId", "IRSimSessionDetailsId"); + + b.HasOne("iRLeagueDatabaseCore.Models.SessionEntity", "Session") + .WithOne("SessionResult") + .HasForeignKey("iRLeagueDatabaseCore.Models.SessionResultEntity", "LeagueId", "SessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("IRSimSessionDetails"); + + b.Navigation("Result"); + + b.Navigation("Session"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingConfigurationEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("StandingConfigs") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("League"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.ChampSeasonEntity", "ChampSeason") + .WithMany("Standings") + .HasForeignKey("LeagueId", "ChampSeasonId"); + + b.HasOne("iRLeagueDatabaseCore.Models.EventEntity", "Event") + .WithMany() + .HasForeignKey("LeagueId", "EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.SeasonEntity", "Season") + .WithMany("Standings") + .HasForeignKey("LeagueId", "SeasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.StandingConfigurationEntity", "StandingConfig") + .WithMany("Standings") + .HasForeignKey("LeagueId", "StandingConfigId") + .OnDelete(DeleteBehavior.ClientCascade); + + b.Navigation("ChampSeason"); + + b.Navigation("Event"); + + b.Navigation("Season"); + + b.Navigation("StandingConfig"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingRowEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "Member") + .WithMany() + .HasForeignKey("MemberId"); + + b.HasOne("iRLeagueDatabaseCore.Models.StandingEntity", "SeasonStanding") + .WithMany("StandingRows") + .HasForeignKey("LeagueId", "StandingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.TeamEntity", "Team") + .WithMany() + .HasForeignKey("LeagueId", "TeamId"); + + b.Navigation("Member"); + + b.Navigation("SeasonStanding"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingRows_ScoredResultRows", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", "ScoredResultRow") + .WithMany("StandingRows") + .HasForeignKey("LeagueId", "ScoredResultRowRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.StandingRowEntity", "StandingRow") + .WithMany("ResultRows") + .HasForeignKey("LeagueId", "StandingRowRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ScoredResultRow"); + + b.Navigation("StandingRow"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StatisticSetEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "CurrentChamp") + .WithMany("StatisticSets") + .HasForeignKey("CurrentChampId"); + + b.HasOne("iRLeagueDatabaseCore.Models.SeasonEntity", "Season") + .WithMany("StatisticSets") + .HasForeignKey("LeagueId", "SeasonId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CurrentChamp"); + + b.Navigation("Season"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.TeamEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("Teams") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("League"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.TrackConfigEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.TrackGroupEntity", "TrackGroup") + .WithMany("TrackConfigs") + .HasForeignKey("TrackGroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TrackGroup"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.VoteCategoryEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("VoteCategories") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("League"); + }); + + modelBuilder.Entity("MemberEntityScoredSessionResultEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", null) + .WithMany() + .HasForeignKey("CleanestDriversId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoredSessionResultEntity", null) + .WithMany() + .HasForeignKey("CleanestDriverResultsLeagueId", "CleanestDriverResultsSessionResultId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("MemberEntityScoredSessionResultEntity1", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", null) + .WithMany() + .HasForeignKey("HardChargersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoredSessionResultEntity", null) + .WithMany() + .HasForeignKey("HardChargerResultsLeagueId", "HardChargerResultsSessionResultId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("StatisticSetEntityStatisticSetEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.StatisticSetEntity", null) + .WithMany() + .HasForeignKey("DependendStatisticSetsLeagueId", "DependendStatisticSetsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.StatisticSetEntity", null) + .WithMany() + .HasForeignKey("LeagueStatisticSetsLeagueId", "LeagueStatisticSetsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.AcceptedReviewVoteEntity", b => + { + b.Navigation("ReviewPenaltys"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ChampionshipEntity", b => + { + b.Navigation("ChampSeasons"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ChampSeasonEntity", b => + { + b.Navigation("EventResults"); + + b.Navigation("Filters"); + + b.Navigation("ResultConfigurations"); + + b.Navigation("Standings"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.EventEntity", b => + { + b.Navigation("EventResult"); + + b.Navigation("ScoredEventResults"); + + b.Navigation("Sessions"); + + b.Navigation("SimSessionDetails"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.EventResultEntity", b => + { + b.Navigation("ScoredResults"); + + b.Navigation("SessionResults"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IncidentReviewEntity", b => + { + b.Navigation("AcceptedReviewVotes"); + + b.Navigation("Comments"); + + b.Navigation("ReviewPenaltys"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.LeagueEntity", b => + { + b.Navigation("Championships"); + + b.Navigation("LeagueMembers"); + + b.Navigation("Payments"); + + b.Navigation("PointRules"); + + b.Navigation("ResultConfigs"); + + b.Navigation("Scorings"); + + b.Navigation("Seasons"); + + b.Navigation("StandingConfigs"); + + b.Navigation("Teams"); + + b.Navigation("VoteCategories"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.MemberEntity", b => + { + b.Navigation("AcceptedReviewVotes"); + + b.Navigation("CommentReviewVotes"); + + b.Navigation("DriverStatisticRows"); + + b.Navigation("FastestAvgLapResults"); + + b.Navigation("FastestLapResults"); + + b.Navigation("FastestQualyLapResults"); + + b.Navigation("ResultRows"); + + b.Navigation("StatisticSets"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.PointRuleEntity", b => + { + b.Navigation("AutoPenalties"); + + b.Navigation("Scorings"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", b => + { + b.Navigation("PointFilters"); + + b.Navigation("ResultFilters"); + + b.Navigation("Scorings"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ReviewCommentEntity", b => + { + b.Navigation("Replies"); + + b.Navigation("ReviewCommentVotes"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScheduleEntity", b => + { + b.Navigation("Events"); + + b.Navigation("Scorings"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredEventResultEntity", b => + { + b.Navigation("ScoredSessionResults"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", b => + { + b.Navigation("AddPenalties"); + + b.Navigation("ReviewPenalties"); + + b.Navigation("StandingRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredSessionResultEntity", b => + { + b.Navigation("ScoredResultRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoringEntity", b => + { + b.Navigation("DependendScorings"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SeasonEntity", b => + { + b.Navigation("ChampSeasons"); + + b.Navigation("Schedules"); + + b.Navigation("Standings"); + + b.Navigation("StatisticSets"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SessionEntity", b => + { + b.Navigation("IncidentReviews"); + + b.Navigation("SessionResult"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SessionResultEntity", b => + { + b.Navigation("ResultRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingConfigurationEntity", b => + { + b.Navigation("ChampSeasons"); + + b.Navigation("Standings"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingEntity", b => + { + b.Navigation("StandingRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingRowEntity", b => + { + b.Navigation("ResultRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StatisticSetEntity", b => + { + b.Navigation("DriverStatisticRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SubscriptionEntity", b => + { + b.Navigation("Payments"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.TeamEntity", b => + { + b.Navigation("Members"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.TrackGroupEntity", b => + { + b.Navigation("TrackConfigs"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.VoteCategoryEntity", b => + { + b.Navigation("AcceptedReviewVotes"); + + b.Navigation("CommentReviewVotes"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/iRLeagueDatabaseCore/Migrations/20231016191207_ReviewsTeamAtFault.cs b/src/iRLeagueDatabaseCore/Migrations/20231016191207_ReviewsTeamAtFault.cs new file mode 100644 index 0000000..3d66ac0 --- /dev/null +++ b/src/iRLeagueDatabaseCore/Migrations/20231016191207_ReviewsTeamAtFault.cs @@ -0,0 +1,113 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace iRLeagueDatabaseCore.Migrations +{ + public partial class ReviewsTeamAtFault : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TeamAtFaultId", + table: "ReviewCommentVotes", + type: "bigint", + nullable: true); + + migrationBuilder.AddColumn( + name: "TeamAtFaultId", + table: "AcceptedReviewVotes", + type: "bigint", + nullable: true); + + migrationBuilder.CreateTable( + name: "IncidentReviewsInvolvedTeams", + columns: table => new + { + LeagueId = table.Column(type: "bigint", nullable: false), + ReviewRefId = table.Column(type: "bigint", nullable: false), + TeamRefId = table.Column(type: "bigint", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IncidentReviewsInvolvedTeams", x => new { x.ReviewRefId, x.LeagueId, x.TeamRefId }); + table.ForeignKey( + name: "FK_IncidentReviewsInvolvedTeams_IncidentReviews_LeagueId_Review~", + columns: x => new { x.LeagueId, x.ReviewRefId }, + principalTable: "IncidentReviews", + principalColumns: new[] { "LeagueId", "ReviewId" }, + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_IncidentReviewsInvolvedTeams_Teams_LeagueId_TeamRefId", + columns: x => new { x.LeagueId, x.TeamRefId }, + principalTable: "Teams", + principalColumns: new[] { "LeagueId", "TeamId" }, + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_ReviewCommentVotes_LeagueId_TeamAtFaultId", + table: "ReviewCommentVotes", + columns: new[] { "LeagueId", "TeamAtFaultId" }); + + migrationBuilder.CreateIndex( + name: "IX_AcceptedReviewVotes_LeagueId_TeamAtFaultId", + table: "AcceptedReviewVotes", + columns: new[] { "LeagueId", "TeamAtFaultId" }); + + migrationBuilder.CreateIndex( + name: "IX_IncidentReviewsInvolvedTeams_LeagueId_ReviewRefId", + table: "IncidentReviewsInvolvedTeams", + columns: new[] { "LeagueId", "ReviewRefId" }); + + migrationBuilder.CreateIndex( + name: "IX_IncidentReviewsInvolvedTeams_LeagueId_TeamRefId", + table: "IncidentReviewsInvolvedTeams", + columns: new[] { "LeagueId", "TeamRefId" }); + + migrationBuilder.AddForeignKey( + name: "FK_AcceptedReviewVotes_Teams_LeagueId_TeamAtFaultId", + table: "AcceptedReviewVotes", + columns: new[] { "LeagueId", "TeamAtFaultId" }, + principalTable: "Teams", + principalColumns: new[] { "LeagueId", "TeamId" }); + + migrationBuilder.AddForeignKey( + name: "FK_ReviewCommentVotes_Teams_LeagueId_TeamAtFaultId", + table: "ReviewCommentVotes", + columns: new[] { "LeagueId", "TeamAtFaultId" }, + principalTable: "Teams", + principalColumns: new[] { "LeagueId", "TeamId" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_AcceptedReviewVotes_Teams_LeagueId_TeamAtFaultId", + table: "AcceptedReviewVotes"); + + migrationBuilder.DropForeignKey( + name: "FK_ReviewCommentVotes_Teams_LeagueId_TeamAtFaultId", + table: "ReviewCommentVotes"); + + migrationBuilder.DropTable( + name: "IncidentReviewsInvolvedTeams"); + + migrationBuilder.DropIndex( + name: "IX_ReviewCommentVotes_LeagueId_TeamAtFaultId", + table: "ReviewCommentVotes"); + + migrationBuilder.DropIndex( + name: "IX_AcceptedReviewVotes_LeagueId_TeamAtFaultId", + table: "AcceptedReviewVotes"); + + migrationBuilder.DropColumn( + name: "TeamAtFaultId", + table: "ReviewCommentVotes"); + + migrationBuilder.DropColumn( + name: "TeamAtFaultId", + table: "AcceptedReviewVotes"); + } + } +} diff --git a/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs b/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs index 63083e1..2e315c8 100644 --- a/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs +++ b/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs @@ -59,6 +59,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ReviewId") .HasColumnType("bigint"); + b.Property("TeamAtFaultId") + .HasColumnType("bigint"); + b.Property("VoteCategoryId") .HasColumnType("bigint"); @@ -74,6 +77,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("LeagueId", "ReviewId"); + b.HasIndex("LeagueId", "TeamAtFaultId"); + b.HasIndex("LeagueId", "VoteCategoryId"); b.ToTable("AcceptedReviewVotes"); @@ -775,6 +780,26 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("IncidentReviews"); }); + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IncidentReviewsInvolvedTeams", b => + { + b.Property("ReviewRefId") + .HasColumnType("bigint"); + + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("TeamRefId") + .HasColumnType("bigint"); + + b.HasKey("ReviewRefId", "LeagueId", "TeamRefId"); + + b.HasIndex("LeagueId", "ReviewRefId"); + + b.HasIndex("LeagueId", "TeamRefId"); + + b.ToTable("IncidentReviewsInvolvedTeams"); + }); + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IRSimSessionDetailsEntity", b => { b.Property("LeagueId") @@ -1528,6 +1553,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("MemberAtFaultId") .HasColumnType("bigint"); + b.Property("TeamAtFaultId") + .HasColumnType("bigint"); + b.Property("VoteCategoryId") .HasColumnType("bigint"); @@ -1543,6 +1571,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("LeagueId", "CommentId"); + b.HasIndex("LeagueId", "TeamAtFaultId"); + b.HasIndex("LeagueId", "VoteCategoryId"); b.ToTable("ReviewCommentVotes"); @@ -2831,6 +2861,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.HasOne("iRLeagueDatabaseCore.Models.TeamEntity", "TeamAtFault") + .WithMany() + .HasForeignKey("LeagueId", "TeamAtFaultId"); + b.HasOne("iRLeagueDatabaseCore.Models.VoteCategoryEntity", "VoteCategory") .WithMany("AcceptedReviewVotes") .HasForeignKey("LeagueId", "VoteCategoryId"); @@ -2839,6 +2873,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Review"); + b.Navigation("TeamAtFault"); + b.Navigation("VoteCategory"); }); @@ -3055,6 +3091,25 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Session"); }); + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IncidentReviewsInvolvedTeams", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.IncidentReviewEntity", "Review") + .WithMany() + .HasForeignKey("LeagueId", "ReviewRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.TeamEntity", "Team") + .WithMany() + .HasForeignKey("LeagueId", "TeamRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Review"); + + b.Navigation("Team"); + }); + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IRSimSessionDetailsEntity", b => { b.HasOne("iRLeagueDatabaseCore.Models.EventEntity", "Event") @@ -3242,6 +3297,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.HasOne("iRLeagueDatabaseCore.Models.TeamEntity", "TeamAtFault") + .WithMany() + .HasForeignKey("LeagueId", "TeamAtFaultId"); + b.HasOne("iRLeagueDatabaseCore.Models.VoteCategoryEntity", "VoteCategory") .WithMany("CommentReviewVotes") .HasForeignKey("LeagueId", "VoteCategoryId"); @@ -3250,6 +3309,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("MemberAtFault"); + b.Navigation("TeamAtFault"); + b.Navigation("VoteCategory"); }); diff --git a/src/iRLeagueDatabaseCore/Models/IncidentReviewEntity.cs b/src/iRLeagueDatabaseCore/Models/IncidentReviewEntity.cs index 55f5735..9b694f0 100644 --- a/src/iRLeagueDatabaseCore/Models/IncidentReviewEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/IncidentReviewEntity.cs @@ -77,6 +77,9 @@ public void Configure(EntityTypeBuilder entity) entity.HasMany(d => d.InvolvedTeams) .WithMany(p => p.InvolvedReviews) - .UsingEntity(e => e.ToTable("IncidentReviewsInvolvedTeams")); + .UsingEntity( + right => right.HasOne(x => x.Team).WithMany().HasForeignKey(x => new { x.LeagueId, x.TeamRefId }), + left => left.HasOne(x => x.Review).WithMany().HasForeignKey(x => new { x.LeagueId, x.ReviewRefId }) + ); } } diff --git a/src/iRLeagueDatabaseCore/Models/IncidentReviewsInvolvedTeams.cs b/src/iRLeagueDatabaseCore/Models/IncidentReviewsInvolvedTeams.cs new file mode 100644 index 0000000..5944f28 --- /dev/null +++ b/src/iRLeagueDatabaseCore/Models/IncidentReviewsInvolvedTeams.cs @@ -0,0 +1,11 @@ + +namespace iRLeagueDatabaseCore.Models; +public partial class IncidentReviewsInvolvedTeams +{ + public long LeagueId { get; set; } + public long ReviewRefId { get; set; } + public long TeamRefId { get; set; } + + public virtual IncidentReviewEntity Review { get; set; } + public virtual TeamEntity Team { get; set; } +} diff --git a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj index 3bf9a8f..ac3f090 100644 --- a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj +++ b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj @@ -24,7 +24,7 @@ Library net6.0 iRLeagueDatabaseCore - 0.9.2 + 0.10.0-dev.1 Simon Schulze Simon Schulze This package contains the Entityframework configuration for a Code first project From 3f1125052208999e94034a28430d84190d811727 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Tue, 17 Oct 2023 22:14:54 +0200 Subject: [PATCH 3/6] Init InvolvedTeams list --- src/iRLeagueDatabaseCore/Models/IncidentReviewEntity.cs | 1 + src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/iRLeagueDatabaseCore/Models/IncidentReviewEntity.cs b/src/iRLeagueDatabaseCore/Models/IncidentReviewEntity.cs index 9b694f0..b5d2723 100644 --- a/src/iRLeagueDatabaseCore/Models/IncidentReviewEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/IncidentReviewEntity.cs @@ -9,6 +9,7 @@ public IncidentReviewEntity() AcceptedReviewVotes = new HashSet(); Comments = new HashSet(); InvolvedMembers = new HashSet(); + InvolvedTeams = new HashSet(); ReviewPenaltys = new HashSet(); } diff --git a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj index ac3f090..8e4f101 100644 --- a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj +++ b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj @@ -24,7 +24,7 @@ Library net6.0 iRLeagueDatabaseCore - 0.10.0-dev.1 + 0.10.0-dev.2 Simon Schulze Simon Schulze This package contains the Entityframework configuration for a Code first project From f3dd2ed26c3269b6e9b58ad2dc27d5a7533ad08f Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Wed, 25 Oct 2023 15:48:47 +0200 Subject: [PATCH 4/6] Use CarNumber as string --- .../DatabaseBenchmarks.csproj | 2 +- .../MigrationCarNumberAsString.sql | 42 + ...231025134401_CarNumberAsString.Designer.cs | 3942 +++++++++++++++++ .../20231025134401_CarNumberAsString.cs | 96 + .../LeagueDbContextModelSnapshot.cs | 10 +- .../Models/ResultRowBase.cs | 2 +- .../Models/ResultRowEntity.cs | 2 + .../Models/ScoredResultRowEntity.cs | 2 + .../iRLeagueDatabaseCore.csproj | 5 +- 9 files changed, 4095 insertions(+), 8 deletions(-) create mode 100644 src/iRLeagueDatabaseCore/MigrationCarNumberAsString.sql create mode 100644 src/iRLeagueDatabaseCore/Migrations/20231025134401_CarNumberAsString.Designer.cs create mode 100644 src/iRLeagueDatabaseCore/Migrations/20231025134401_CarNumberAsString.cs diff --git a/src/DatabaseBenchmarks/DatabaseBenchmarks.csproj b/src/DatabaseBenchmarks/DatabaseBenchmarks.csproj index 934f4a8..9f888f9 100644 --- a/src/DatabaseBenchmarks/DatabaseBenchmarks.csproj +++ b/src/DatabaseBenchmarks/DatabaseBenchmarks.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/iRLeagueDatabaseCore/MigrationCarNumberAsString.sql b/src/iRLeagueDatabaseCore/MigrationCarNumberAsString.sql new file mode 100644 index 0000000..d083cbb --- /dev/null +++ b/src/iRLeagueDatabaseCore/MigrationCarNumberAsString.sql @@ -0,0 +1,42 @@ +USE LeagueDatabase; + +START TRANSACTION; + +-- pre migration +-- safe the CarNumber values as ints + +CREATE TEMPORARY TABLE TmpResultRowsNumbers ( + ResultRowId BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, + CarNumber INT NOT NULL +); + +INSERT INTO TmpResultRowsNumbers (ResultRowId, CarNumber) + SELECT ResultRowId, CarNumber + FROM ResultRows; + +CREATE TEMPORARY TABLE TmpScoredResultRowsNumbers ( + ScoredResultRowId BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, + CarNumber INT NOT NULL +); + +INSERT INTO TmpScoredResultRowsNumbers (ScoredResultRowId, CarNumber) + SELECT ScoredResultRowId, CarNumber + FROM ScoredResultRows; + +-- post migration +-- restore CarNumber values as string + +UPDATE ResultRows `rows` + JOIN TmpResultRowsNumbers `numbers` + ON `numbers`.ResultRowId=`rows`.ResultRowId + SET `rows`.CarNumber = `numbers`.CarNumber; + +UPDATE ScoredResultRows `rows` + JOIN TmpScoredResultRowsNumbers `numbers` + ON `numbers`.ScoredResultRowId=`rows`.ScoredResultRowId + SET `rows`.CarNumber = `numbers`.CarNumber; + +DROP TABLE TmpResultRowsNumbers; +DROP TABLE TmpScoredResultRowsNumbers; + +ROLLBACK; \ No newline at end of file diff --git a/src/iRLeagueDatabaseCore/Migrations/20231025134401_CarNumberAsString.Designer.cs b/src/iRLeagueDatabaseCore/Migrations/20231025134401_CarNumberAsString.Designer.cs new file mode 100644 index 0000000..fa5c37c --- /dev/null +++ b/src/iRLeagueDatabaseCore/Migrations/20231025134401_CarNumberAsString.Designer.cs @@ -0,0 +1,3942 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using iRLeagueDatabaseCore.Models; + +#nullable disable + +namespace iRLeagueDatabaseCore.Migrations +{ + [DbContext(typeof(LeagueDbContext))] + [Migration("20231025134401_CarNumberAsString")] + partial class CarNumberAsString + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseCollation("Latin1_General_CI_AS") + .HasAnnotation("ProductVersion", "6.0.7") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("IncidentReviewEntityMemberEntity", b => + { + b.Property("InvolvedMembersId") + .HasColumnType("bigint"); + + b.Property("InvolvedReviewsLeagueId") + .HasColumnType("bigint"); + + b.Property("InvolvedReviewsReviewId") + .HasColumnType("bigint"); + + b.HasKey("InvolvedMembersId", "InvolvedReviewsLeagueId", "InvolvedReviewsReviewId"); + + b.HasIndex("InvolvedReviewsLeagueId", "InvolvedReviewsReviewId"); + + b.ToTable("IncidentReviewsInvolvedMembers", (string)null); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.AcceptedReviewVoteEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ReviewVoteId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("MemberAtFaultId") + .HasColumnType("bigint"); + + b.Property("ReviewId") + .HasColumnType("bigint"); + + b.Property("TeamAtFaultId") + .HasColumnType("bigint"); + + b.Property("VoteCategoryId") + .HasColumnType("bigint"); + + b.HasKey("LeagueId", "ReviewVoteId"); + + b.HasAlternateKey("ReviewVoteId"); + + b.HasIndex("MemberAtFaultId"); + + b.HasIndex("ReviewId"); + + b.HasIndex("VoteCategoryId"); + + b.HasIndex("LeagueId", "ReviewId"); + + b.HasIndex("LeagueId", "TeamAtFaultId"); + + b.HasIndex("LeagueId", "VoteCategoryId"); + + b.ToTable("AcceptedReviewVotes"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.AddPenaltyEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("AddPenaltyId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Corner") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Lap") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Reason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("ScoredResultRowId") + .HasColumnType("bigint"); + + b.Property("Value") + .HasColumnType("json"); + + b.HasKey("LeagueId", "AddPenaltyId"); + + b.HasAlternateKey("AddPenaltyId"); + + b.HasIndex("LeagueId", "ScoredResultRowId"); + + b.ToTable("AddPenaltys"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.AutoPenaltyConfigEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("PenaltyConfigId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Conditions") + .IsRequired() + .HasColumnType("json"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("PointRuleId") + .HasColumnType("bigint"); + + b.Property("Points") + .HasColumnType("int"); + + b.Property("Positions") + .HasColumnType("int"); + + b.Property("Time") + .HasColumnType("time(6)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("LeagueId", "PenaltyConfigId"); + + b.HasAlternateKey("PenaltyConfigId"); + + b.HasIndex("LeagueId", "PointRuleId"); + + b.ToTable("AutoPenaltyConfigs", (string)null); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ChampionshipEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ChampionshipId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime(6)"); + + b.Property("DisplayName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("IsArchived") + .HasColumnType("tinyint(1)"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .HasMaxLength(80) + .HasColumnType("varchar(80)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "ChampionshipId"); + + b.HasAlternateKey("ChampionshipId"); + + b.ToTable("Championships", (string)null); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ChampSeasonEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ChampSeasonId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ChampionshipId") + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime(6)"); + + b.Property("DefaultResultConfigId") + .HasColumnType("bigint"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime(6)"); + + b.Property("ResultKind") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("SeasonId") + .HasColumnType("bigint"); + + b.Property("StandingConfigId") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "ChampSeasonId"); + + b.HasAlternateKey("ChampSeasonId"); + + b.HasIndex("LeagueId", "ChampionshipId"); + + b.HasIndex("LeagueId", "DefaultResultConfigId"); + + b.HasIndex("LeagueId", "SeasonId"); + + b.HasIndex("LeagueId", "StandingConfigId"); + + b.ToTable("ChampSeasons", (string)null); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.CustomIncidentEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("IncidentId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("Text") + .HasColumnType("longtext"); + + b.HasKey("LeagueId", "IncidentId"); + + b.HasAlternateKey("IncidentId"); + + b.ToTable("CustomIncidents"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.DriverStatisticRowEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("StatisticSetId") + .HasColumnType("bigint"); + + b.Property("MemberId") + .HasColumnType("bigint"); + + b.Property("AvgFinalPosition") + .HasColumnType("double"); + + b.Property("AvgFinishPosition") + .HasColumnType("double"); + + b.Property("AvgIRating") + .HasColumnType("double"); + + b.Property("AvgIncidentsPerKm") + .HasColumnType("double"); + + b.Property("AvgIncidentsPerLap") + .HasColumnType("double"); + + b.Property("AvgIncidentsPerRace") + .HasColumnType("double"); + + b.Property("AvgPenaltyPointsPerKm") + .HasColumnType("double"); + + b.Property("AvgPenaltyPointsPerLap") + .HasColumnType("double"); + + b.Property("AvgPenaltyPointsPerRace") + .HasColumnType("double"); + + b.Property("AvgPointsPerRace") + .HasColumnType("double"); + + b.Property("AvgSRating") + .HasColumnType("double"); + + b.Property("AvgStartPosition") + .HasColumnType("double"); + + b.Property("BestFinalPosition") + .HasColumnType("int"); + + b.Property("BestFinishPosition") + .HasColumnType("double"); + + b.Property("BestStartPosition") + .HasColumnType("double"); + + b.Property("BonusPoints") + .HasColumnType("double"); + + b.Property("CleanestDriverAwards") + .HasColumnType("int"); + + b.Property("CompletedLaps") + .HasColumnType("double"); + + b.Property("CurrentSeasonPosition") + .HasColumnType("int"); + + b.Property("DrivenKm") + .HasColumnType("double"); + + b.Property("EndIRating") + .HasColumnType("int"); + + b.Property("EndSRating") + .HasColumnType("double"); + + b.Property("FastestLaps") + .HasColumnType("int"); + + b.Property("FirstRaceDate") + .HasColumnType("datetime"); + + b.Property("FirstRaceFinalPosition") + .HasColumnType("int"); + + b.Property("FirstRaceFinishPosition") + .HasColumnType("double"); + + b.Property("FirstRaceId") + .HasColumnType("bigint"); + + b.Property("FirstRaceStartPosition") + .HasColumnType("double"); + + b.Property("FirstResultRowId") + .HasColumnType("bigint"); + + b.Property("FirstSessionDate") + .HasColumnType("datetime"); + + b.Property("FirstSessionId") + .HasColumnType("bigint"); + + b.Property("HardChargerAwards") + .HasColumnType("int"); + + b.Property("Incidents") + .HasColumnType("double"); + + b.Property("IncidentsUnderInvestigation") + .HasColumnType("int"); + + b.Property("IncidentsWithPenalty") + .HasColumnType("int"); + + b.Property("LastRaceDate") + .HasColumnType("datetime"); + + b.Property("LastRaceFinalPosition") + .HasColumnType("int"); + + b.Property("LastRaceFinishPosition") + .HasColumnType("double"); + + b.Property("LastRaceId") + .HasColumnType("bigint"); + + b.Property("LastRaceStartPosition") + .HasColumnType("double"); + + b.Property("LastResultRowId") + .HasColumnType("bigint"); + + b.Property("LastSessionDate") + .HasColumnType("datetime"); + + b.Property("LastSessionId") + .HasColumnType("bigint"); + + b.Property("LeadingKm") + .HasColumnType("double"); + + b.Property("LeadingLaps") + .HasColumnType("double"); + + b.Property("PenaltyPoints") + .HasColumnType("double"); + + b.Property("Poles") + .HasColumnType("int"); + + b.Property("RacePoints") + .HasColumnType("double"); + + b.Property("Races") + .HasColumnType("int"); + + b.Property("RacesCompleted") + .HasColumnType("int"); + + b.Property("RacesInPoints") + .HasColumnType("int"); + + b.Property("StartIRating") + .HasColumnType("int"); + + b.Property("StartSRating") + .HasColumnType("double"); + + b.Property("Titles") + .HasColumnType("int"); + + b.Property("Top10") + .HasColumnType("int"); + + b.Property("Top15") + .HasColumnType("int"); + + b.Property("Top20") + .HasColumnType("int"); + + b.Property("Top25") + .HasColumnType("int"); + + b.Property("Top3") + .HasColumnType("int"); + + b.Property("Top5") + .HasColumnType("int"); + + b.Property("TotalPoints") + .HasColumnType("double"); + + b.Property("Wins") + .HasColumnType("int"); + + b.Property("WorstFinalPosition") + .HasColumnType("int"); + + b.Property("WorstFinishPosition") + .HasColumnType("double"); + + b.Property("WorstStartPosition") + .HasColumnType("double"); + + b.HasKey("LeagueId", "StatisticSetId", "MemberId"); + + b.HasIndex("MemberId"); + + b.HasIndex("StatisticSetId"); + + b.HasIndex("LeagueId", "FirstRaceId"); + + b.HasIndex("LeagueId", "FirstResultRowId"); + + b.HasIndex("LeagueId", "FirstSessionId"); + + b.HasIndex("LeagueId", "LastRaceId"); + + b.HasIndex("LeagueId", "LastResultRowId"); + + b.HasIndex("LeagueId", "LastSessionId"); + + b.ToTable("DriverStatisticRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.EventEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("EventId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("Date") + .HasColumnType("datetime"); + + b.Property("Duration") + .HasColumnType("bigint"); + + b.Property("EventType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("IrResultLink") + .HasColumnType("longtext"); + + b.Property("IrSessionId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("ScheduleId") + .HasColumnType("bigint"); + + b.Property("TrackId") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "EventId"); + + b.HasAlternateKey("EventId"); + + b.HasIndex("TrackId"); + + b.HasIndex("LeagueId", "ScheduleId"); + + b.ToTable("Events"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.EventResultConfigs", b => + { + b.Property("EventRefId") + .HasColumnType("bigint"); + + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ResultConfigRefId") + .HasColumnType("bigint"); + + b.HasKey("EventRefId", "LeagueId", "ResultConfigRefId"); + + b.HasIndex("LeagueId", "EventRefId"); + + b.HasIndex("LeagueId", "ResultConfigRefId"); + + b.ToTable("EventResultConfigs"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.EventResultEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("EventId") + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("RequiresRecalculation") + .HasColumnType("tinyint(1)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "EventId"); + + b.HasIndex("EventId"); + + b.ToTable("EventResults"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.FilterOptionEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("FilterOptionId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ChampSeasonId") + .HasColumnType("bigint"); + + b.Property("Conditions") + .IsRequired() + .HasColumnType("json"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("PointFilterResultConfigId") + .HasColumnType("bigint"); + + b.Property("ResultFilterResultConfigId") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "FilterOptionId"); + + b.HasAlternateKey("FilterOptionId"); + + b.HasIndex("LeagueId", "ChampSeasonId"); + + b.HasIndex("LeagueId", "PointFilterResultConfigId"); + + b.HasIndex("LeagueId", "ResultFilterResultConfigId"); + + b.ToTable("FilterOptions"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IncidentReviewEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ReviewId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("AuthorName") + .HasColumnType("longtext"); + + b.Property("AuthorUserId") + .HasColumnType("longtext"); + + b.Property("Corner") + .HasColumnType("longtext"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("FullDescription") + .HasColumnType("longtext"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("IncidentKind") + .HasColumnType("longtext"); + + b.Property("IncidentNr") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("OnLap") + .HasColumnType("longtext"); + + b.Property("ResultLongText") + .HasColumnType("longtext"); + + b.Property("SessionId") + .HasColumnType("bigint"); + + b.Property("TimeStamp") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "ReviewId"); + + b.HasAlternateKey("ReviewId"); + + b.HasIndex("SessionId"); + + b.HasIndex("LeagueId", "SessionId"); + + b.ToTable("IncidentReviews"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IncidentReviewsInvolvedTeams", b => + { + b.Property("ReviewRefId") + .HasColumnType("bigint"); + + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("TeamRefId") + .HasColumnType("bigint"); + + b.HasKey("ReviewRefId", "LeagueId", "TeamRefId"); + + b.HasIndex("LeagueId", "ReviewRefId"); + + b.HasIndex("LeagueId", "TeamRefId"); + + b.ToTable("IncidentReviewsInvolvedTeams"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IRSimSessionDetailsEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("SessionDetailsId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Category") + .HasColumnType("longtext"); + + b.Property("ConfigName") + .HasColumnType("longtext"); + + b.Property("CornersPerLap") + .HasColumnType("int"); + + b.Property("DamageModel") + .HasColumnType("int"); + + b.Property("EndTime") + .HasColumnType("datetime"); + + b.Property("EventAverageLap") + .HasColumnType("bigint"); + + b.Property("EventId") + .HasColumnType("bigint"); + + b.Property("EventLapsComplete") + .HasColumnType("int"); + + b.Property("EventStrengthOfField") + .HasColumnType("int"); + + b.Property("Fog") + .HasColumnType("int"); + + b.Property("IRRaceWeek") + .HasColumnType("int"); + + b.Property("IRSeasonId") + .HasColumnType("bigint"); + + b.Property("IRSeasonName") + .HasColumnType("longtext"); + + b.Property("IRSeasonQuarter") + .HasColumnType("int"); + + b.Property("IRSeasonYear") + .HasColumnType("int"); + + b.Property("IRSessionId") + .HasColumnType("bigint"); + + b.Property("IRSubsessionId") + .HasColumnType("bigint"); + + b.Property("IRTrackId") + .HasColumnType("int"); + + b.Property("KmDistPerLap") + .HasColumnType("double"); + + b.Property("LeaveMarbles") + .HasColumnType("tinyint(1)"); + + b.Property("LicenseCategory") + .HasColumnType("int"); + + b.Property("MaxWeeks") + .HasColumnType("int"); + + b.Property("NumCautionLaps") + .HasColumnType("int"); + + b.Property("NumCautions") + .HasColumnType("int"); + + b.Property("NumLeadChanges") + .HasColumnType("int"); + + b.Property("PracticeGripCompound") + .HasColumnType("int"); + + b.Property("PracticeRubber") + .HasColumnType("int"); + + b.Property("QualifyGripCompund") + .HasColumnType("int"); + + b.Property("QualifyRubber") + .HasColumnType("int"); + + b.Property("RaceGripCompound") + .HasColumnType("int"); + + b.Property("RaceRubber") + .HasColumnType("int"); + + b.Property("RelHumidity") + .HasColumnType("int"); + + b.Property("SessionName") + .HasColumnType("longtext"); + + b.Property("SimStartUtcOffset") + .HasColumnType("bigint"); + + b.Property("SimStartUtcTime") + .HasColumnType("datetime"); + + b.Property("Skies") + .HasColumnType("int"); + + b.Property("StartTime") + .HasColumnType("datetime"); + + b.Property("TempUnits") + .HasColumnType("int"); + + b.Property("TempValue") + .HasColumnType("int"); + + b.Property("TimeOfDay") + .HasColumnType("int"); + + b.Property("TrackCategoryId") + .HasColumnType("int"); + + b.Property("TrackName") + .HasColumnType("longtext"); + + b.Property("WarmupGripCompound") + .HasColumnType("int"); + + b.Property("WarmupRubber") + .HasColumnType("int"); + + b.Property("WeatherType") + .HasColumnType("int"); + + b.Property("WeatherVarInitial") + .HasColumnType("int"); + + b.Property("WeatherVarOngoing") + .HasColumnType("int"); + + b.Property("WindDir") + .HasColumnType("int"); + + b.Property("WindUnits") + .HasColumnType("int"); + + b.HasKey("LeagueId", "SessionDetailsId"); + + b.HasAlternateKey("SessionDetailsId"); + + b.HasIndex("LeagueId", "EventId"); + + b.ToTable("IRSimSessionDetails"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.LeagueEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DescriptionPlain") + .HasColumnType("longtext"); + + b.Property("EnableLiveReviews") + .HasColumnType("tinyint(1)"); + + b.Property("EnableProtests") + .HasColumnType("tinyint(1)"); + + b.Property("Expires") + .HasColumnType("datetime(6)"); + + b.Property("IsInitialized") + .HasColumnType("tinyint(1)"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime(6)"); + + b.Property("LeaguePublic") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(85) + .HasColumnType("varchar(85)"); + + b.Property("NameFull") + .HasColumnType("longtext"); + + b.Property("ProtestCoolDownPeriod") + .HasColumnType("bigint"); + + b.Property("ProtestFormAccess") + .HasColumnType("int"); + + b.Property("ProtestsClosedAfter") + .HasColumnType("bigint"); + + b.Property("ProtestsPublic") + .HasColumnType("int"); + + b.Property("Subscription") + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasAlternateKey("Name"); + + b.ToTable("Leagues"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.LeagueMemberEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("MemberId") + .HasColumnType("bigint"); + + b.Property("TeamId") + .HasColumnType("bigint"); + + b.HasKey("LeagueId", "MemberId"); + + b.HasIndex("MemberId"); + + b.HasIndex("LeagueId", "TeamId"); + + b.ToTable("LeagueMembers"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.MemberEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("DanLisaId") + .HasColumnType("longtext"); + + b.Property("DiscordId") + .HasColumnType("longtext"); + + b.Property("Firstname") + .HasColumnType("longtext"); + + b.Property("IRacingId") + .HasColumnType("longtext"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("Lastname") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Members"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.PaymentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("LastPaymentReceived") + .HasColumnType("datetime(6)"); + + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("NextPaymentDue") + .HasColumnType("datetime(6)"); + + b.Property("PlanId") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("SubscriptionId") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Type") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("LeagueId"); + + b.HasIndex("PlanId"); + + b.ToTable("Payments", (string)null); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.PointRuleEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("PointRuleId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("BonusPoints") + .IsRequired() + .HasColumnType("json"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("FinalSortOptions") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("MaxPoints") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("PointDropOff") + .HasColumnType("int"); + + b.Property("PointsPerPlace") + .HasColumnType("longtext"); + + b.Property("PointsSortOptions") + .HasColumnType("longtext"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "PointRuleId"); + + b.HasAlternateKey("PointRuleId"); + + b.ToTable("PointRules"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ProtestEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ProtestId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("AuthorMemberId") + .HasColumnType("bigint"); + + b.Property("Corner") + .HasColumnType("longtext"); + + b.Property("FullDescription") + .HasColumnType("longtext"); + + b.Property("OnLap") + .HasColumnType("longtext"); + + b.Property("SessionId") + .HasColumnType("bigint"); + + b.HasKey("LeagueId", "ProtestId"); + + b.HasAlternateKey("ProtestId"); + + b.HasIndex("LeagueId", "AuthorMemberId"); + + b.HasIndex("LeagueId", "SessionId"); + + b.ToTable("Protests", (string)null); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.Protests_LeagueMembers", b => + { + b.Property("MemberId") + .HasColumnType("bigint"); + + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ProtestId") + .HasColumnType("bigint"); + + b.HasKey("MemberId", "LeagueId", "ProtestId"); + + b.HasIndex("LeagueId", "MemberId"); + + b.HasIndex("LeagueId", "ProtestId"); + + b.ToTable("Protests_LeagueMembers"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ResultConfigId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ChampSeasonId") + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("DisplayName") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("ResultsPerTeam") + .HasColumnType("int"); + + b.Property("SourceResultConfigId") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "ResultConfigId"); + + b.HasAlternateKey("ResultConfigId"); + + b.HasIndex("LeagueId", "ChampSeasonId"); + + b.HasIndex("LeagueId", "SourceResultConfigId"); + + b.ToTable("ResultConfigurations"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ResultRowEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ResultRowId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("AvgLapTime") + .HasColumnType("bigint"); + + b.Property("Car") + .HasColumnType("longtext"); + + b.Property("CarClass") + .HasColumnType("longtext"); + + b.Property("CarId") + .HasColumnType("int"); + + b.Property("CarNumber") + .HasMaxLength(8) + .HasColumnType("varchar(8)"); + + b.Property("ClassId") + .HasColumnType("int"); + + b.Property("ClubId") + .HasColumnType("int"); + + b.Property("ClubName") + .HasColumnType("longtext"); + + b.Property("CompletedLaps") + .HasColumnType("double"); + + b.Property("CompletedPct") + .HasColumnType("double"); + + b.Property("ContactLaps") + .HasColumnType("longtext"); + + b.Property("Division") + .HasColumnType("int"); + + b.Property("FastLapNr") + .HasColumnType("int"); + + b.Property("FastestLapTime") + .HasColumnType("bigint"); + + b.Property("FinishPosition") + .HasColumnType("double"); + + b.Property("IRacingId") + .HasColumnType("longtext"); + + b.Property("Incidents") + .HasColumnType("double"); + + b.Property("Interval") + .HasColumnType("bigint"); + + b.Property("LeadLaps") + .HasColumnType("double"); + + b.Property("License") + .HasColumnType("longtext"); + + b.Property("MemberId") + .HasColumnType("bigint"); + + b.Property("NewCpi") + .HasColumnType("int"); + + b.Property("NewIRating") + .HasColumnType("int"); + + b.Property("NewLicenseLevel") + .HasColumnType("int"); + + b.Property("NewSafetyRating") + .HasColumnType("double"); + + b.Property("NumContactLaps") + .HasColumnType("int"); + + b.Property("NumOfftrackLaps") + .HasColumnType("int"); + + b.Property("NumPitStops") + .HasColumnType("int"); + + b.Property("OfftrackLaps") + .HasColumnType("longtext"); + + b.Property("OldCpi") + .HasColumnType("int"); + + b.Property("OldIRating") + .HasColumnType("int"); + + b.Property("OldLicenseLevel") + .HasColumnType("int"); + + b.Property("OldSafetyRating") + .HasColumnType("double"); + + b.Property("PittedLaps") + .HasColumnType("longtext"); + + b.Property("PointsEligible") + .HasColumnType("tinyint(1)"); + + b.Property("PositionChange") + .HasColumnType("double"); + + b.Property("QualifyingTime") + .HasColumnType("bigint"); + + b.Property("QualifyingTimeAt") + .HasColumnType("datetime"); + + b.Property("RacePoints") + .HasColumnType("double"); + + b.Property("SeasonStartIRating") + .HasColumnType("int"); + + b.Property("SimSessionType") + .HasColumnType("int"); + + b.Property("StartPosition") + .HasColumnType("double"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("SubSessionId") + .HasColumnType("bigint"); + + b.Property("TeamId") + .HasColumnType("bigint"); + + b.HasKey("LeagueId", "ResultRowId"); + + b.HasAlternateKey("ResultRowId"); + + b.HasIndex("MemberId"); + + b.HasIndex("LeagueId", "MemberId"); + + b.HasIndex("LeagueId", "SubSessionId"); + + b.HasIndex("LeagueId", "TeamId"); + + b.ToTable("ResultRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ReviewCommentEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("CommentId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("AuthorName") + .HasColumnType("longtext"); + + b.Property("AuthorUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("Date") + .HasColumnType("datetime"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("ReplyToCommentId") + .HasColumnType("bigint"); + + b.Property("ReviewId") + .HasColumnType("bigint"); + + b.Property("Text") + .HasColumnType("longtext"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "CommentId"); + + b.HasAlternateKey("CommentId"); + + b.HasIndex("ReplyToCommentId"); + + b.HasIndex("ReviewId"); + + b.HasIndex("LeagueId", "ReplyToCommentId"); + + b.HasIndex("LeagueId", "ReviewId"); + + b.ToTable("ReviewComments"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ReviewCommentVoteEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ReviewVoteId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CommentId") + .HasColumnType("bigint"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("MemberAtFaultId") + .HasColumnType("bigint"); + + b.Property("TeamAtFaultId") + .HasColumnType("bigint"); + + b.Property("VoteCategoryId") + .HasColumnType("bigint"); + + b.HasKey("LeagueId", "ReviewVoteId"); + + b.HasAlternateKey("ReviewVoteId"); + + b.HasIndex("CommentId"); + + b.HasIndex("MemberAtFaultId"); + + b.HasIndex("VoteCategoryId"); + + b.HasIndex("LeagueId", "CommentId"); + + b.HasIndex("LeagueId", "TeamAtFaultId"); + + b.HasIndex("LeagueId", "VoteCategoryId"); + + b.ToTable("ReviewCommentVotes"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ReviewPenaltyEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ResultRowId") + .HasColumnType("bigint"); + + b.Property("ReviewId") + .HasColumnType("bigint"); + + b.Property("ReviewVoteId") + .HasColumnType("bigint"); + + b.Property("Value") + .HasColumnType("json"); + + b.HasKey("LeagueId", "ResultRowId", "ReviewId", "ReviewVoteId"); + + b.HasIndex("ReviewId"); + + b.HasIndex("ReviewVoteId"); + + b.HasIndex("LeagueId", "ResultRowId"); + + b.HasIndex("LeagueId", "ReviewId"); + + b.HasIndex("LeagueId", "ReviewVoteId"); + + b.ToTable("ReviewPenaltys"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScheduleEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ScheduleId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("SeasonId") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "ScheduleId"); + + b.HasAlternateKey("ScheduleId"); + + b.HasIndex("LeagueId", "SeasonId"); + + b.ToTable("Schedules"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredEventResultEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ResultId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ChampSeasonId") + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("EventId") + .HasColumnType("bigint"); + + b.Property("EventResultEntityEventId") + .HasColumnType("bigint"); + + b.Property("EventResultEntityLeagueId") + .HasColumnType("bigint"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("ResultConfigId") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "ResultId"); + + b.HasAlternateKey("ResultId"); + + b.HasIndex("EventResultEntityLeagueId", "EventResultEntityEventId"); + + b.HasIndex("LeagueId", "ChampSeasonId"); + + b.HasIndex("LeagueId", "EventId"); + + b.HasIndex("LeagueId", "ResultConfigId"); + + b.ToTable("ScoredEventResults"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ScoredResultRowId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("AvgLapTime") + .HasColumnType("bigint"); + + b.Property("BonusPoints") + .HasColumnType("double"); + + b.Property("Car") + .HasColumnType("longtext"); + + b.Property("CarClass") + .HasColumnType("longtext"); + + b.Property("CarId") + .HasColumnType("int"); + + b.Property("CarNumber") + .HasMaxLength(8) + .HasColumnType("varchar(8)"); + + b.Property("ClassId") + .HasColumnType("int"); + + b.Property("ClubId") + .HasColumnType("int"); + + b.Property("ClubName") + .HasColumnType("longtext"); + + b.Property("CompletedLaps") + .HasColumnType("double"); + + b.Property("CompletedPct") + .HasColumnType("double"); + + b.Property("ContactLaps") + .HasColumnType("longtext"); + + b.Property("Division") + .HasColumnType("int"); + + b.Property("FastLapNr") + .HasColumnType("int"); + + b.Property("FastestLapTime") + .HasColumnType("bigint"); + + b.Property("FinalPosition") + .HasColumnType("int"); + + b.Property("FinalPositionChange") + .HasColumnType("double"); + + b.Property("FinishPosition") + .HasColumnType("double"); + + b.Property("IRacingId") + .HasColumnType("longtext"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("Incidents") + .HasColumnType("double"); + + b.Property("Interval") + .HasColumnType("bigint"); + + b.Property("LeadLaps") + .HasColumnType("double"); + + b.Property("License") + .HasColumnType("longtext"); + + b.Property("MemberId") + .HasColumnType("bigint"); + + b.Property("NewCpi") + .HasColumnType("int"); + + b.Property("NewIRating") + .HasColumnType("int"); + + b.Property("NewLicenseLevel") + .HasColumnType("int"); + + b.Property("NewSafetyRating") + .HasColumnType("double"); + + b.Property("NumContactLaps") + .HasColumnType("int"); + + b.Property("NumOfftrackLaps") + .HasColumnType("int"); + + b.Property("NumPitStops") + .HasColumnType("int"); + + b.Property("OfftrackLaps") + .HasColumnType("longtext"); + + b.Property("OldCpi") + .HasColumnType("int"); + + b.Property("OldIRating") + .HasColumnType("int"); + + b.Property("OldLicenseLevel") + .HasColumnType("int"); + + b.Property("OldSafetyRating") + .HasColumnType("double"); + + b.Property("PenaltyPoints") + .HasColumnType("double"); + + b.Property("PittedLaps") + .HasColumnType("longtext"); + + b.Property("PointsEligible") + .HasColumnType("tinyint(1)"); + + b.Property("PositionChange") + .HasColumnType("double"); + + b.Property("QualifyingTime") + .HasColumnType("bigint"); + + b.Property("QualifyingTimeAt") + .HasColumnType("datetime"); + + b.Property("RacePoints") + .HasColumnType("double"); + + b.Property("SeasonStartIRating") + .HasColumnType("int"); + + b.Property("SessionResultId") + .HasColumnType("bigint"); + + b.Property("SimSessionType") + .HasColumnType("int"); + + b.Property("StartPosition") + .HasColumnType("double"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("TeamId") + .HasColumnType("bigint"); + + b.Property("TotalPoints") + .HasColumnType("double"); + + b.HasKey("LeagueId", "ScoredResultRowId"); + + b.HasAlternateKey("ScoredResultRowId"); + + b.HasIndex("MemberId"); + + b.HasIndex("TeamId"); + + b.HasIndex("LeagueId", "SessionResultId"); + + b.HasIndex("LeagueId", "TeamId"); + + b.ToTable("ScoredResultRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredSessionResultEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("SessionResultId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("Discriminator") + .HasColumnType("longtext"); + + b.Property("FastestAvgLap") + .HasColumnType("bigint"); + + b.Property("FastestAvgLapDriverMemberId") + .HasColumnType("bigint"); + + b.Property("FastestLap") + .HasColumnType("bigint"); + + b.Property("FastestLapDriverMemberId") + .HasColumnType("bigint"); + + b.Property("FastestQualyLap") + .HasColumnType("bigint"); + + b.Property("FastestQualyLapDriverMemberId") + .HasColumnType("bigint"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("ResultId") + .HasColumnType("bigint"); + + b.Property("ScoringId") + .HasColumnType("bigint"); + + b.Property("SessionNr") + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "SessionResultId"); + + b.HasAlternateKey("SessionResultId"); + + b.HasIndex("FastestAvgLapDriverMemberId"); + + b.HasIndex("FastestLapDriverMemberId"); + + b.HasIndex("FastestQualyLapDriverMemberId"); + + b.HasIndex("LeagueId", "ResultId"); + + b.HasIndex("LeagueId", "ScoringId"); + + b.ToTable("ScoredSessionResults"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredTeamResultRowsResultRows", b => + { + b.Property("TeamParentRowRefId") + .HasColumnType("bigint"); + + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("TeamResultRowRefId") + .HasColumnType("bigint"); + + b.HasKey("TeamParentRowRefId", "LeagueId", "TeamResultRowRefId"); + + b.HasIndex("LeagueId", "TeamParentRowRefId"); + + b.HasIndex("LeagueId", "TeamResultRowRefId"); + + b.ToTable("ScoredTeamResultRowsResultRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoringEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("ScoringId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("ExtScoringSourceId") + .HasColumnType("bigint"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("IsCombinedResult") + .HasColumnType("tinyint(1)"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("MaxResultsPerGroup") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("PointsRuleId") + .HasColumnType("bigint"); + + b.Property("ResultConfigId") + .HasColumnType("bigint"); + + b.Property("ScheduleEntityLeagueId") + .HasColumnType("bigint"); + + b.Property("ScheduleEntityScheduleId") + .HasColumnType("bigint"); + + b.Property("ShowResults") + .HasColumnType("tinyint(1)"); + + b.Property("UpdateTeamOnRecalculation") + .HasColumnType("tinyint(1)"); + + b.Property("UseExternalSourcePoints") + .HasColumnType("tinyint(1)"); + + b.Property("UseResultSetTeam") + .HasColumnType("tinyint(1)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "ScoringId"); + + b.HasAlternateKey("ScoringId"); + + b.HasIndex("ExtScoringSourceId"); + + b.HasIndex("LeagueId", "ExtScoringSourceId"); + + b.HasIndex("LeagueId", "PointsRuleId"); + + b.HasIndex("LeagueId", "ResultConfigId"); + + b.HasIndex("ScheduleEntityLeagueId", "ScheduleEntityScheduleId"); + + b.ToTable("Scorings"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SeasonEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("SeasonId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("Finished") + .HasColumnType("tinyint(1)"); + + b.Property("HideCommentsBeforeVoted") + .HasColumnType("tinyint(1)"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("MainScoringLeagueId") + .HasColumnType("bigint"); + + b.Property("MainScoringScoringId") + .HasColumnType("bigint"); + + b.Property("SeasonEnd") + .HasColumnType("datetime"); + + b.Property("SeasonName") + .HasColumnType("longtext"); + + b.Property("SeasonStart") + .HasColumnType("datetime"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "SeasonId"); + + b.HasAlternateKey("SeasonId"); + + b.HasIndex("MainScoringLeagueId", "MainScoringScoringId"); + + b.ToTable("Seasons"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SessionEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("SessionId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("Duration") + .HasColumnType("bigint"); + + b.Property("EventId") + .HasColumnType("bigint"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("Laps") + .HasColumnType("int"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("SessionNr") + .HasColumnType("int"); + + b.Property("SessionType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartOffset") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "SessionId"); + + b.HasAlternateKey("SessionId"); + + b.HasIndex("EventId", "SessionId"); + + b.HasIndex("LeagueId", "EventId"); + + b.ToTable("Sessions"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SessionResultEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("SessionId") + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime(6)"); + + b.Property("EventId") + .HasColumnType("bigint"); + + b.Property("IRSimSessionDetailsId") + .HasColumnType("bigint"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime(6)"); + + b.Property("SimSessionType") + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "SessionId"); + + b.HasIndex("SessionId"); + + b.HasIndex("LeagueId", "EventId"); + + b.HasIndex("LeagueId", "IRSimSessionDetailsId"); + + b.ToTable("SessionResults"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingConfigurationEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("StandingConfigId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime(6)"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("ResultKind") + .HasColumnType("int"); + + b.Property("SortOptions") + .HasColumnType("longtext"); + + b.Property("UseCombinedResult") + .HasColumnType("tinyint(1)"); + + b.Property("Version") + .HasColumnType("int"); + + b.Property("WeeksCounted") + .HasColumnType("int"); + + b.HasKey("LeagueId", "StandingConfigId"); + + b.HasAlternateKey("StandingConfigId"); + + b.ToTable("StandingConfigurations"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("StandingId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ChampSeasonId") + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime(6)"); + + b.Property("EventId") + .HasColumnType("bigint"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("IsTeamStanding") + .HasColumnType("tinyint(1)"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("SeasonId") + .HasColumnType("bigint"); + + b.Property("StandingConfigId") + .HasColumnType("bigint"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "StandingId"); + + b.HasAlternateKey("StandingId"); + + b.HasIndex("LeagueId", "ChampSeasonId"); + + b.HasIndex("LeagueId", "EventId"); + + b.HasIndex("LeagueId", "SeasonId"); + + b.HasIndex("LeagueId", "StandingConfigId"); + + b.ToTable("Standings"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingRowEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("StandingRowId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CarClass") + .HasColumnType("longtext"); + + b.Property("ClassId") + .HasColumnType("int"); + + b.Property("CompletedLaps") + .HasColumnType("int"); + + b.Property("CompletedLapsChange") + .HasColumnType("int"); + + b.Property("DroppedResultCount") + .HasColumnType("int"); + + b.Property("FastestLaps") + .HasColumnType("int"); + + b.Property("FastestLapsChange") + .HasColumnType("int"); + + b.Property("Incidents") + .HasColumnType("int"); + + b.Property("IncidentsChange") + .HasColumnType("int"); + + b.Property("LastIrating") + .HasColumnType("int"); + + b.Property("LastPosition") + .HasColumnType("int"); + + b.Property("LeadLaps") + .HasColumnType("int"); + + b.Property("LeadLapsChange") + .HasColumnType("int"); + + b.Property("MemberId") + .HasColumnType("bigint"); + + b.Property("PenaltyPoints") + .HasColumnType("int"); + + b.Property("PenaltyPointsChange") + .HasColumnType("int"); + + b.Property("PolePositions") + .HasColumnType("int"); + + b.Property("PolePositionsChange") + .HasColumnType("int"); + + b.Property("Position") + .HasColumnType("int"); + + b.Property("PositionChange") + .HasColumnType("int"); + + b.Property("RacePoints") + .HasColumnType("int"); + + b.Property("RacePointsChange") + .HasColumnType("int"); + + b.Property("Races") + .HasColumnType("int"); + + b.Property("RacesCounted") + .HasColumnType("int"); + + b.Property("RacesInPoints") + .HasColumnType("int"); + + b.Property("RacesScored") + .HasColumnType("int"); + + b.Property("StandingId") + .HasColumnType("bigint"); + + b.Property("StartIrating") + .HasColumnType("int"); + + b.Property("TeamId") + .HasColumnType("bigint"); + + b.Property("Top10") + .HasColumnType("int"); + + b.Property("Top3") + .HasColumnType("int"); + + b.Property("Top5") + .HasColumnType("int"); + + b.Property("TotalPoints") + .HasColumnType("int"); + + b.Property("TotalPointsChange") + .HasColumnType("int"); + + b.Property("Wins") + .HasColumnType("int"); + + b.Property("WinsChange") + .HasColumnType("int"); + + b.HasKey("LeagueId", "StandingRowId"); + + b.HasAlternateKey("StandingRowId"); + + b.HasIndex("MemberId"); + + b.HasIndex("LeagueId", "StandingId"); + + b.HasIndex("LeagueId", "TeamId"); + + b.ToTable("StandingRows", (string)null); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingRows_ScoredResultRows", b => + { + b.Property("ScoredResultRowRefId") + .HasColumnType("bigint"); + + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("StandingRowRefId") + .HasColumnType("bigint"); + + b.Property("IsScored") + .HasColumnType("tinyint(1)"); + + b.HasKey("ScoredResultRowRefId", "LeagueId", "StandingRowRefId"); + + b.HasIndex("LeagueId", "ScoredResultRowRefId"); + + b.HasIndex("LeagueId", "StandingRowRefId"); + + b.ToTable("StandingRows_ScoredResultRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StatisticSetEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("CurrentChampId") + .HasColumnType("bigint"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FinishedRaces") + .HasColumnType("int"); + + b.Property("FirstDate") + .HasColumnType("datetime"); + + b.Property("ImportSource") + .HasColumnType("longtext"); + + b.Property("IsSeasonFinished") + .HasColumnType("tinyint(1)"); + + b.Property("LastDate") + .HasColumnType("datetime"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("RequiresRecalculation") + .HasColumnType("tinyint(1)"); + + b.Property("SeasonId") + .HasColumnType("bigint"); + + b.Property("StandingId") + .HasColumnType("bigint"); + + b.Property("UpdateInterval") + .HasColumnType("bigint"); + + b.Property("UpdateTime") + .HasColumnType("datetime"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "Id"); + + b.HasAlternateKey("Id"); + + b.HasIndex("CurrentChampId"); + + b.HasIndex("LeagueId", "SeasonId"); + + b.HasIndex("LeagueId", "StandingId"); + + b.ToTable("StatisticSets"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SubscriptionEntity", b => + { + b.Property("PlanId") + .HasColumnType("varchar(255)"); + + b.Property("Interval") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Price") + .HasColumnType("double"); + + b.HasKey("PlanId"); + + b.ToTable("Subscriptions", (string)null); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.TeamEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("TeamId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreatedByUserId") + .HasColumnType("longtext"); + + b.Property("CreatedByUserName") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime"); + + b.Property("IRacingTeamId") + .HasColumnType("bigint"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("LastModifiedByUserId") + .HasColumnType("longtext"); + + b.Property("LastModifiedByUserName") + .HasColumnType("longtext"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("Profile") + .HasColumnType("longtext"); + + b.Property("TeamColor") + .HasColumnType("longtext"); + + b.Property("TeamHomepage") + .HasColumnType("longtext"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("LeagueId", "TeamId"); + + b.HasAlternateKey("TeamId"); + + b.ToTable("Teams"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.TrackConfigEntity", b => + { + b.Property("TrackId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ConfigName") + .HasColumnType("longtext"); + + b.Property("ConfigType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("HasNightLighting") + .HasColumnType("tinyint(1)"); + + b.Property("LegacyTrackId") + .HasColumnType("longtext"); + + b.Property("LengthKm") + .HasColumnType("double"); + + b.Property("TrackGroupId") + .HasColumnType("bigint"); + + b.Property("Turns") + .HasColumnType("int"); + + b.HasKey("TrackId"); + + b.HasIndex("TrackGroupId"); + + b.ToTable("TrackConfigs"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.TrackGroupEntity", b => + { + b.Property("TrackGroupId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Location") + .HasColumnType("longtext"); + + b.Property("TrackName") + .HasColumnType("longtext"); + + b.HasKey("TrackGroupId"); + + b.ToTable("TrackGroups"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.VoteCategoryEntity", b => + { + b.Property("LeagueId") + .HasColumnType("bigint"); + + b.Property("CatId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("DefaultPenalty") + .HasColumnType("int"); + + b.Property("ImportId") + .HasColumnType("bigint"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("Text") + .HasColumnType("longtext"); + + b.HasKey("LeagueId", "CatId"); + + b.HasAlternateKey("CatId"); + + b.ToTable("VoteCategories"); + }); + + modelBuilder.Entity("MemberEntityScoredSessionResultEntity", b => + { + b.Property("CleanestDriversId") + .HasColumnType("bigint"); + + b.Property("CleanestDriverResultsLeagueId") + .HasColumnType("bigint"); + + b.Property("CleanestDriverResultsSessionResultId") + .HasColumnType("bigint"); + + b.HasKey("CleanestDriversId", "CleanestDriverResultsLeagueId", "CleanestDriverResultsSessionResultId"); + + b.HasIndex("CleanestDriverResultsLeagueId", "CleanestDriverResultsSessionResultId"); + + b.ToTable("ScoredResultsCleanestDrivers", (string)null); + }); + + modelBuilder.Entity("MemberEntityScoredSessionResultEntity1", b => + { + b.Property("HardChargersId") + .HasColumnType("bigint"); + + b.Property("HardChargerResultsLeagueId") + .HasColumnType("bigint"); + + b.Property("HardChargerResultsSessionResultId") + .HasColumnType("bigint"); + + b.HasKey("HardChargersId", "HardChargerResultsLeagueId", "HardChargerResultsSessionResultId"); + + b.HasIndex("HardChargerResultsLeagueId", "HardChargerResultsSessionResultId"); + + b.ToTable("ScoredResultsHardChargers", (string)null); + }); + + modelBuilder.Entity("StatisticSetEntityStatisticSetEntity", b => + { + b.Property("DependendStatisticSetsLeagueId") + .HasColumnType("bigint"); + + b.Property("DependendStatisticSetsId") + .HasColumnType("bigint"); + + b.Property("LeagueStatisticSetsLeagueId") + .HasColumnType("bigint"); + + b.Property("LeagueStatisticSetsId") + .HasColumnType("bigint"); + + b.HasKey("DependendStatisticSetsLeagueId", "DependendStatisticSetsId", "LeagueStatisticSetsLeagueId", "LeagueStatisticSetsId"); + + b.HasIndex("LeagueStatisticSetsLeagueId", "LeagueStatisticSetsId"); + + b.ToTable("LeagueStatisticSetsStatisticSets", (string)null); + }); + + modelBuilder.Entity("IncidentReviewEntityMemberEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", null) + .WithMany() + .HasForeignKey("InvolvedMembersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.IncidentReviewEntity", null) + .WithMany() + .HasForeignKey("InvolvedReviewsLeagueId", "InvolvedReviewsReviewId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.AcceptedReviewVoteEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "MemberAtFault") + .WithMany("AcceptedReviewVotes") + .HasForeignKey("MemberAtFaultId"); + + b.HasOne("iRLeagueDatabaseCore.Models.IncidentReviewEntity", "Review") + .WithMany("AcceptedReviewVotes") + .HasForeignKey("LeagueId", "ReviewId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.TeamEntity", "TeamAtFault") + .WithMany() + .HasForeignKey("LeagueId", "TeamAtFaultId"); + + b.HasOne("iRLeagueDatabaseCore.Models.VoteCategoryEntity", "VoteCategory") + .WithMany("AcceptedReviewVotes") + .HasForeignKey("LeagueId", "VoteCategoryId"); + + b.Navigation("MemberAtFault"); + + b.Navigation("Review"); + + b.Navigation("TeamAtFault"); + + b.Navigation("VoteCategory"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.AddPenaltyEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", "ScoredResultRow") + .WithMany("AddPenalties") + .HasForeignKey("LeagueId", "ScoredResultRowId") + .OnDelete(DeleteBehavior.ClientCascade) + .IsRequired(); + + b.Navigation("ScoredResultRow"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.AutoPenaltyConfigEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.PointRuleEntity", "PointRule") + .WithMany("AutoPenalties") + .HasForeignKey("LeagueId", "PointRuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PointRule"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ChampionshipEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("Championships") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("League"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ChampSeasonEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.ChampionshipEntity", "Championship") + .WithMany("ChampSeasons") + .HasForeignKey("LeagueId", "ChampionshipId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", "DefaultResultConfig") + .WithMany() + .HasForeignKey("LeagueId", "DefaultResultConfigId"); + + b.HasOne("iRLeagueDatabaseCore.Models.SeasonEntity", "Season") + .WithMany("ChampSeasons") + .HasForeignKey("LeagueId", "SeasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.StandingConfigurationEntity", "StandingConfiguration") + .WithMany("ChampSeasons") + .HasForeignKey("LeagueId", "StandingConfigId"); + + b.Navigation("Championship"); + + b.Navigation("DefaultResultConfig"); + + b.Navigation("Season"); + + b.Navigation("StandingConfiguration"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.CustomIncidentEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany() + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("League"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.DriverStatisticRowEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "Member") + .WithMany("DriverStatisticRows") + .HasForeignKey("MemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.SessionEntity", "FirstRace") + .WithMany() + .HasForeignKey("LeagueId", "FirstRaceId"); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", "FirstResultRow") + .WithMany() + .HasForeignKey("LeagueId", "FirstResultRowId"); + + b.HasOne("iRLeagueDatabaseCore.Models.SessionEntity", "FirstSession") + .WithMany() + .HasForeignKey("LeagueId", "FirstSessionId"); + + b.HasOne("iRLeagueDatabaseCore.Models.SessionEntity", "LastRace") + .WithMany() + .HasForeignKey("LeagueId", "LastRaceId"); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", "LastResultRow") + .WithMany() + .HasForeignKey("LeagueId", "LastResultRowId"); + + b.HasOne("iRLeagueDatabaseCore.Models.SessionEntity", "LastSession") + .WithMany() + .HasForeignKey("LeagueId", "LastSessionId"); + + b.HasOne("iRLeagueDatabaseCore.Models.StatisticSetEntity", "StatisticSet") + .WithMany("DriverStatisticRows") + .HasForeignKey("LeagueId", "StatisticSetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FirstRace"); + + b.Navigation("FirstResultRow"); + + b.Navigation("FirstSession"); + + b.Navigation("LastRace"); + + b.Navigation("LastResultRow"); + + b.Navigation("LastSession"); + + b.Navigation("Member"); + + b.Navigation("StatisticSet"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.EventEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.TrackConfigEntity", "Track") + .WithMany() + .HasForeignKey("TrackId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("iRLeagueDatabaseCore.Models.ScheduleEntity", "Schedule") + .WithMany("Events") + .HasForeignKey("LeagueId", "ScheduleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Schedule"); + + b.Navigation("Track"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.EventResultConfigs", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.EventEntity", "Event") + .WithMany() + .HasForeignKey("LeagueId", "EventRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", "ResultConfig") + .WithMany() + .HasForeignKey("LeagueId", "ResultConfigRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Event"); + + b.Navigation("ResultConfig"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.EventResultEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.EventEntity", "Event") + .WithOne("EventResult") + .HasForeignKey("iRLeagueDatabaseCore.Models.EventResultEntity", "LeagueId", "EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Event"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.FilterOptionEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.ChampSeasonEntity", "ChampSeason") + .WithMany("Filters") + .HasForeignKey("LeagueId", "ChampSeasonId") + .OnDelete(DeleteBehavior.ClientCascade); + + b.HasOne("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", "PointFilterResultConfig") + .WithMany("PointFilters") + .HasForeignKey("LeagueId", "PointFilterResultConfigId") + .OnDelete(DeleteBehavior.ClientCascade); + + b.HasOne("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", "ResultFilterResultConfig") + .WithMany("ResultFilters") + .HasForeignKey("LeagueId", "ResultFilterResultConfigId") + .OnDelete(DeleteBehavior.ClientCascade); + + b.Navigation("ChampSeason"); + + b.Navigation("PointFilterResultConfig"); + + b.Navigation("ResultFilterResultConfig"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IncidentReviewEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.SessionEntity", "Session") + .WithMany("IncidentReviews") + .HasForeignKey("LeagueId", "SessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Session"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IncidentReviewsInvolvedTeams", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.IncidentReviewEntity", "Review") + .WithMany() + .HasForeignKey("LeagueId", "ReviewRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.TeamEntity", "Team") + .WithMany() + .HasForeignKey("LeagueId", "TeamRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Review"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IRSimSessionDetailsEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.EventEntity", "Event") + .WithMany("SimSessionDetails") + .HasForeignKey("LeagueId", "EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Event"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.LeagueMemberEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("LeagueMembers") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "Member") + .WithMany() + .HasForeignKey("MemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.TeamEntity", "Team") + .WithMany("Members") + .HasForeignKey("LeagueId", "TeamId"); + + b.Navigation("League"); + + b.Navigation("Member"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.PaymentEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("Payments") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.SubscriptionEntity", "Subscription") + .WithMany("Payments") + .HasForeignKey("PlanId"); + + b.Navigation("League"); + + b.Navigation("Subscription"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.PointRuleEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("PointRules") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("League"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ProtestEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueMemberEntity", "Author") + .WithMany() + .HasForeignKey("LeagueId", "AuthorMemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.SessionEntity", "Session") + .WithMany() + .HasForeignKey("LeagueId", "SessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Session"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.Protests_LeagueMembers", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueMemberEntity", "Member") + .WithMany() + .HasForeignKey("LeagueId", "MemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ProtestEntity", "Protest") + .WithMany() + .HasForeignKey("LeagueId", "ProtestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Member"); + + b.Navigation("Protest"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("ResultConfigs") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ChampSeasonEntity", "ChampSeason") + .WithMany("ResultConfigurations") + .HasForeignKey("LeagueId", "ChampSeasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", "SourceResultConfig") + .WithMany() + .HasForeignKey("LeagueId", "SourceResultConfigId"); + + b.Navigation("ChampSeason"); + + b.Navigation("League"); + + b.Navigation("SourceResultConfig"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ResultRowEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "Member") + .WithMany("ResultRows") + .HasForeignKey("MemberId") + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.LeagueMemberEntity", "LeagueMember") + .WithMany() + .HasForeignKey("LeagueId", "MemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.SessionResultEntity", "SubResult") + .WithMany("ResultRows") + .HasForeignKey("LeagueId", "SubSessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.TeamEntity", "Team") + .WithMany() + .HasForeignKey("LeagueId", "TeamId"); + + b.Navigation("LeagueMember"); + + b.Navigation("Member"); + + b.Navigation("SubResult"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ReviewCommentEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.ReviewCommentEntity", "ReplyToComment") + .WithMany("Replies") + .HasForeignKey("LeagueId", "ReplyToCommentId"); + + b.HasOne("iRLeagueDatabaseCore.Models.IncidentReviewEntity", "Review") + .WithMany("Comments") + .HasForeignKey("LeagueId", "ReviewId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("ReplyToComment"); + + b.Navigation("Review"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ReviewCommentVoteEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "MemberAtFault") + .WithMany("CommentReviewVotes") + .HasForeignKey("MemberAtFaultId"); + + b.HasOne("iRLeagueDatabaseCore.Models.ReviewCommentEntity", "Comment") + .WithMany("ReviewCommentVotes") + .HasForeignKey("LeagueId", "CommentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.TeamEntity", "TeamAtFault") + .WithMany() + .HasForeignKey("LeagueId", "TeamAtFaultId"); + + b.HasOne("iRLeagueDatabaseCore.Models.VoteCategoryEntity", "VoteCategory") + .WithMany("CommentReviewVotes") + .HasForeignKey("LeagueId", "VoteCategoryId"); + + b.Navigation("Comment"); + + b.Navigation("MemberAtFault"); + + b.Navigation("TeamAtFault"); + + b.Navigation("VoteCategory"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ReviewPenaltyEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", "ResultRow") + .WithMany("ReviewPenalties") + .HasForeignKey("LeagueId", "ResultRowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.IncidentReviewEntity", "Review") + .WithMany("ReviewPenaltys") + .HasForeignKey("LeagueId", "ReviewId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.AcceptedReviewVoteEntity", "ReviewVote") + .WithMany("ReviewPenaltys") + .HasForeignKey("LeagueId", "ReviewVoteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ResultRow"); + + b.Navigation("Review"); + + b.Navigation("ReviewVote"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScheduleEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.SeasonEntity", "Season") + .WithMany("Schedules") + .HasForeignKey("LeagueId", "SeasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Season"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredEventResultEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.EventResultEntity", null) + .WithMany("ScoredResults") + .HasForeignKey("EventResultEntityLeagueId", "EventResultEntityEventId"); + + b.HasOne("iRLeagueDatabaseCore.Models.ChampSeasonEntity", "ChampSeason") + .WithMany("EventResults") + .HasForeignKey("LeagueId", "ChampSeasonId"); + + b.HasOne("iRLeagueDatabaseCore.Models.EventEntity", "Event") + .WithMany("ScoredEventResults") + .HasForeignKey("LeagueId", "EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", "ResultConfig") + .WithMany() + .HasForeignKey("LeagueId", "ResultConfigId"); + + b.Navigation("ChampSeason"); + + b.Navigation("Event"); + + b.Navigation("ResultConfig"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "Member") + .WithMany() + .HasForeignKey("MemberId"); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoredSessionResultEntity", "ScoredSessionResult") + .WithMany("ScoredResultRows") + .HasForeignKey("LeagueId", "SessionResultId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.TeamEntity", "Team") + .WithMany() + .HasForeignKey("LeagueId", "TeamId"); + + b.Navigation("Member"); + + b.Navigation("ScoredSessionResult"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredSessionResultEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "FastestAvgLapDriver") + .WithMany("FastestAvgLapResults") + .HasForeignKey("FastestAvgLapDriverMemberId"); + + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "FastestLapDriver") + .WithMany("FastestLapResults") + .HasForeignKey("FastestLapDriverMemberId"); + + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "FastestQualyLapDriver") + .WithMany("FastestQualyLapResults") + .HasForeignKey("FastestQualyLapDriverMemberId"); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoredEventResultEntity", "ScoredEventResult") + .WithMany("ScoredSessionResults") + .HasForeignKey("LeagueId", "ResultId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoringEntity", "Scoring") + .WithMany() + .HasForeignKey("LeagueId", "ScoringId"); + + b.Navigation("FastestAvgLapDriver"); + + b.Navigation("FastestLapDriver"); + + b.Navigation("FastestQualyLapDriver"); + + b.Navigation("ScoredEventResult"); + + b.Navigation("Scoring"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredTeamResultRowsResultRows", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", "TeamParentRow") + .WithMany() + .HasForeignKey("LeagueId", "TeamParentRowRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", "TeamResultRow") + .WithMany() + .HasForeignKey("LeagueId", "TeamResultRowRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_ScoredTeamResultRowsResultRows_ScoredResultRows_LeagueId_Te~1"); + + b.Navigation("TeamParentRow"); + + b.Navigation("TeamResultRow"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoringEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", null) + .WithMany("Scorings") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoringEntity", "ExtScoringSource") + .WithMany("DependendScorings") + .HasForeignKey("LeagueId", "ExtScoringSourceId"); + + b.HasOne("iRLeagueDatabaseCore.Models.PointRuleEntity", "PointsRule") + .WithMany("Scorings") + .HasForeignKey("LeagueId", "PointsRuleId"); + + b.HasOne("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", "ResultConfiguration") + .WithMany("Scorings") + .HasForeignKey("LeagueId", "ResultConfigId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ScheduleEntity", null) + .WithMany("Scorings") + .HasForeignKey("ScheduleEntityLeagueId", "ScheduleEntityScheduleId"); + + b.Navigation("ExtScoringSource"); + + b.Navigation("PointsRule"); + + b.Navigation("ResultConfiguration"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SeasonEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("Seasons") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoringEntity", "MainScoring") + .WithMany() + .HasForeignKey("MainScoringLeagueId", "MainScoringScoringId"); + + b.Navigation("League"); + + b.Navigation("MainScoring"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SessionEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.EventEntity", "Event") + .WithMany("Sessions") + .HasForeignKey("LeagueId", "EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Event"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SessionResultEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.EventResultEntity", "Result") + .WithMany("SessionResults") + .HasForeignKey("LeagueId", "EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.IRSimSessionDetailsEntity", "IRSimSessionDetails") + .WithMany() + .HasForeignKey("LeagueId", "IRSimSessionDetailsId"); + + b.HasOne("iRLeagueDatabaseCore.Models.SessionEntity", "Session") + .WithOne("SessionResult") + .HasForeignKey("iRLeagueDatabaseCore.Models.SessionResultEntity", "LeagueId", "SessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("IRSimSessionDetails"); + + b.Navigation("Result"); + + b.Navigation("Session"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingConfigurationEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("StandingConfigs") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("League"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.ChampSeasonEntity", "ChampSeason") + .WithMany("Standings") + .HasForeignKey("LeagueId", "ChampSeasonId"); + + b.HasOne("iRLeagueDatabaseCore.Models.EventEntity", "Event") + .WithMany() + .HasForeignKey("LeagueId", "EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.SeasonEntity", "Season") + .WithMany("Standings") + .HasForeignKey("LeagueId", "SeasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.StandingConfigurationEntity", "StandingConfig") + .WithMany("Standings") + .HasForeignKey("LeagueId", "StandingConfigId") + .OnDelete(DeleteBehavior.ClientCascade); + + b.Navigation("ChampSeason"); + + b.Navigation("Event"); + + b.Navigation("Season"); + + b.Navigation("StandingConfig"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingRowEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "Member") + .WithMany() + .HasForeignKey("MemberId"); + + b.HasOne("iRLeagueDatabaseCore.Models.StandingEntity", "SeasonStanding") + .WithMany("StandingRows") + .HasForeignKey("LeagueId", "StandingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.TeamEntity", "Team") + .WithMany() + .HasForeignKey("LeagueId", "TeamId"); + + b.Navigation("Member"); + + b.Navigation("SeasonStanding"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingRows_ScoredResultRows", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", "ScoredResultRow") + .WithMany("StandingRows") + .HasForeignKey("LeagueId", "ScoredResultRowRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.StandingRowEntity", "StandingRow") + .WithMany("ResultRows") + .HasForeignKey("LeagueId", "StandingRowRefId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ScoredResultRow"); + + b.Navigation("StandingRow"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StatisticSetEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", "CurrentChamp") + .WithMany("StatisticSets") + .HasForeignKey("CurrentChampId"); + + b.HasOne("iRLeagueDatabaseCore.Models.SeasonEntity", "Season") + .WithMany("StatisticSets") + .HasForeignKey("LeagueId", "SeasonId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CurrentChamp"); + + b.Navigation("Season"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.TeamEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("Teams") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("League"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.TrackConfigEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.TrackGroupEntity", "TrackGroup") + .WithMany("TrackConfigs") + .HasForeignKey("TrackGroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TrackGroup"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.VoteCategoryEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.LeagueEntity", "League") + .WithMany("VoteCategories") + .HasForeignKey("LeagueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("League"); + }); + + modelBuilder.Entity("MemberEntityScoredSessionResultEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", null) + .WithMany() + .HasForeignKey("CleanestDriversId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoredSessionResultEntity", null) + .WithMany() + .HasForeignKey("CleanestDriverResultsLeagueId", "CleanestDriverResultsSessionResultId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("MemberEntityScoredSessionResultEntity1", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.MemberEntity", null) + .WithMany() + .HasForeignKey("HardChargersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.ScoredSessionResultEntity", null) + .WithMany() + .HasForeignKey("HardChargerResultsLeagueId", "HardChargerResultsSessionResultId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("StatisticSetEntityStatisticSetEntity", b => + { + b.HasOne("iRLeagueDatabaseCore.Models.StatisticSetEntity", null) + .WithMany() + .HasForeignKey("DependendStatisticSetsLeagueId", "DependendStatisticSetsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("iRLeagueDatabaseCore.Models.StatisticSetEntity", null) + .WithMany() + .HasForeignKey("LeagueStatisticSetsLeagueId", "LeagueStatisticSetsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.AcceptedReviewVoteEntity", b => + { + b.Navigation("ReviewPenaltys"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ChampionshipEntity", b => + { + b.Navigation("ChampSeasons"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ChampSeasonEntity", b => + { + b.Navigation("EventResults"); + + b.Navigation("Filters"); + + b.Navigation("ResultConfigurations"); + + b.Navigation("Standings"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.EventEntity", b => + { + b.Navigation("EventResult"); + + b.Navigation("ScoredEventResults"); + + b.Navigation("Sessions"); + + b.Navigation("SimSessionDetails"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.EventResultEntity", b => + { + b.Navigation("ScoredResults"); + + b.Navigation("SessionResults"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.IncidentReviewEntity", b => + { + b.Navigation("AcceptedReviewVotes"); + + b.Navigation("Comments"); + + b.Navigation("ReviewPenaltys"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.LeagueEntity", b => + { + b.Navigation("Championships"); + + b.Navigation("LeagueMembers"); + + b.Navigation("Payments"); + + b.Navigation("PointRules"); + + b.Navigation("ResultConfigs"); + + b.Navigation("Scorings"); + + b.Navigation("Seasons"); + + b.Navigation("StandingConfigs"); + + b.Navigation("Teams"); + + b.Navigation("VoteCategories"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.MemberEntity", b => + { + b.Navigation("AcceptedReviewVotes"); + + b.Navigation("CommentReviewVotes"); + + b.Navigation("DriverStatisticRows"); + + b.Navigation("FastestAvgLapResults"); + + b.Navigation("FastestLapResults"); + + b.Navigation("FastestQualyLapResults"); + + b.Navigation("ResultRows"); + + b.Navigation("StatisticSets"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.PointRuleEntity", b => + { + b.Navigation("AutoPenalties"); + + b.Navigation("Scorings"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", b => + { + b.Navigation("PointFilters"); + + b.Navigation("ResultFilters"); + + b.Navigation("Scorings"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ReviewCommentEntity", b => + { + b.Navigation("Replies"); + + b.Navigation("ReviewCommentVotes"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScheduleEntity", b => + { + b.Navigation("Events"); + + b.Navigation("Scorings"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredEventResultEntity", b => + { + b.Navigation("ScoredSessionResults"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredResultRowEntity", b => + { + b.Navigation("AddPenalties"); + + b.Navigation("ReviewPenalties"); + + b.Navigation("StandingRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoredSessionResultEntity", b => + { + b.Navigation("ScoredResultRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.ScoringEntity", b => + { + b.Navigation("DependendScorings"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SeasonEntity", b => + { + b.Navigation("ChampSeasons"); + + b.Navigation("Schedules"); + + b.Navigation("Standings"); + + b.Navigation("StatisticSets"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SessionEntity", b => + { + b.Navigation("IncidentReviews"); + + b.Navigation("SessionResult"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SessionResultEntity", b => + { + b.Navigation("ResultRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingConfigurationEntity", b => + { + b.Navigation("ChampSeasons"); + + b.Navigation("Standings"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingEntity", b => + { + b.Navigation("StandingRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StandingRowEntity", b => + { + b.Navigation("ResultRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.StatisticSetEntity", b => + { + b.Navigation("DriverStatisticRows"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.SubscriptionEntity", b => + { + b.Navigation("Payments"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.TeamEntity", b => + { + b.Navigation("Members"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.TrackGroupEntity", b => + { + b.Navigation("TrackConfigs"); + }); + + modelBuilder.Entity("iRLeagueDatabaseCore.Models.VoteCategoryEntity", b => + { + b.Navigation("AcceptedReviewVotes"); + + b.Navigation("CommentReviewVotes"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/iRLeagueDatabaseCore/Migrations/20231025134401_CarNumberAsString.cs b/src/iRLeagueDatabaseCore/Migrations/20231025134401_CarNumberAsString.cs new file mode 100644 index 0000000..2d74d0e --- /dev/null +++ b/src/iRLeagueDatabaseCore/Migrations/20231025134401_CarNumberAsString.cs @@ -0,0 +1,96 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace iRLeagueDatabaseCore.Migrations +{ + public partial class CarNumberAsString : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.Sql(""" + -- pre migration + -- safe the CarNumber values as ints + + CREATE TEMPORARY TABLE TmpResultRowsNumbers ( + ResultRowId BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, + CarNumber INT NOT NULL + ); + + INSERT INTO TmpResultRowsNumbers (ResultRowId, CarNumber) + SELECT ResultRowId, CarNumber + FROM ResultRows; + + CREATE TEMPORARY TABLE TmpScoredResultRowsNumbers ( + ScoredResultRowId BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, + CarNumber INT NOT NULL + ); + + INSERT INTO TmpScoredResultRowsNumbers (ScoredResultRowId, CarNumber) + SELECT ScoredResultRowId, CarNumber + FROM ScoredResultRows; + """); + + migrationBuilder.AlterColumn( + name: "CarNumber", + table: "ScoredResultRows", + type: "varchar(8)", + maxLength: 8, + nullable: true, + oldClrType: typeof(int), + oldType: "int"); + + migrationBuilder.AlterColumn( + name: "CarNumber", + table: "ResultRows", + type: "varchar(8)", + maxLength: 8, + nullable: true, + oldClrType: typeof(int), + oldType: "int"); + + migrationBuilder.Sql(""" + -- post migration + -- restore CarNumber values as string + + UPDATE ResultRows `rows` + JOIN TmpResultRowsNumbers `numbers` + ON `numbers`.ResultRowId=`rows`.ResultRowId + SET `rows`.CarNumber = `numbers`.CarNumber; + + UPDATE ScoredResultRows `rows` + JOIN TmpScoredResultRowsNumbers `numbers` + ON `numbers`.ScoredResultRowId=`rows`.ScoredResultRowId + SET `rows`.CarNumber = `numbers`.CarNumber; + + DROP TABLE TmpResultRowsNumbers; + DROP TABLE TmpScoredResultRowsNumbers; + """); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "CarNumber", + table: "ScoredResultRows", + type: "int", + nullable: false, + defaultValue: 0, + oldClrType: typeof(string), + oldType: "varchar(8)", + oldMaxLength: 8, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CarNumber", + table: "ResultRows", + type: "int", + nullable: false, + defaultValue: 0, + oldClrType: typeof(string), + oldType: "varchar(8)", + oldMaxLength: 8, + oldNullable: true); + } + } +} diff --git a/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs b/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs index 2e315c8..17f8447 100644 --- a/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs +++ b/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs @@ -1328,8 +1328,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("CarId") .HasColumnType("int"); - b.Property("CarNumber") - .HasColumnType("int"); + b.Property("CarNumber") + .HasMaxLength(8) + .HasColumnType("varchar(8)"); b.Property("ClassId") .HasColumnType("int"); @@ -1748,8 +1749,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("CarId") .HasColumnType("int"); - b.Property("CarNumber") - .HasColumnType("int"); + b.Property("CarNumber") + .HasMaxLength(8) + .HasColumnType("varchar(8)"); b.Property("ClassId") .HasColumnType("int"); diff --git a/src/iRLeagueDatabaseCore/Models/ResultRowBase.cs b/src/iRLeagueDatabaseCore/Models/ResultRowBase.cs index 5810f6e..474151e 100644 --- a/src/iRLeagueDatabaseCore/Models/ResultRowBase.cs +++ b/src/iRLeagueDatabaseCore/Models/ResultRowBase.cs @@ -4,7 +4,7 @@ public class ResultRowBase { public double StartPosition { get; set; } public double FinishPosition { get; set; } - public int CarNumber { get; set; } + public string CarNumber { get; set; } public int ClassId { get; set; } public string Car { get; set; } public string CarClass { get; set; } diff --git a/src/iRLeagueDatabaseCore/Models/ResultRowEntity.cs b/src/iRLeagueDatabaseCore/Models/ResultRowEntity.cs index 227c7b0..c073a88 100644 --- a/src/iRLeagueDatabaseCore/Models/ResultRowEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/ResultRowEntity.cs @@ -32,6 +32,8 @@ public void Configure(EntityTypeBuilder entity) entity.Property(e => e.ResultRowId) .ValueGeneratedOnAdd(); + entity.Property(e => e.CarNumber).HasMaxLength(8); + entity.Property(e => e.QualifyingTimeAt).HasColumnType("datetime"); entity.Property(e => e.AvgLapTime).HasConversion(); diff --git a/src/iRLeagueDatabaseCore/Models/ScoredResultRowEntity.cs b/src/iRLeagueDatabaseCore/Models/ScoredResultRowEntity.cs index 6b6c297..c0536c7 100644 --- a/src/iRLeagueDatabaseCore/Models/ScoredResultRowEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/ScoredResultRowEntity.cs @@ -102,6 +102,8 @@ public void Configure(EntityTypeBuilder entity) entity.HasIndex(e => e.TeamId); + entity.Property(e => e.CarNumber).HasMaxLength(8); + entity.Property(e => e.QualifyingTimeAt).HasColumnType("datetime"); entity.Property(e => e.AvgLapTime).HasConversion(); diff --git a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj index 8e4f101..3a197fb 100644 --- a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj +++ b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj @@ -3,7 +3,7 @@ - + @@ -23,8 +23,9 @@ Library net6.0 + 11 iRLeagueDatabaseCore - 0.10.0-dev.2 + 0.10.0-dev.3 Simon Schulze Simon Schulze This package contains the Entityframework configuration for a Code first project From 2d5af7e33b7e74b003acad69e337577970113358 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Sun, 29 Oct 2023 02:46:45 +0200 Subject: [PATCH 5/6] bump to version 0.10.0 update packages --- src/DatabaseBenchmarks/DatabaseBenchmarks.csproj | 2 +- src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DatabaseBenchmarks/DatabaseBenchmarks.csproj b/src/DatabaseBenchmarks/DatabaseBenchmarks.csproj index 9f888f9..e68c709 100644 --- a/src/DatabaseBenchmarks/DatabaseBenchmarks.csproj +++ b/src/DatabaseBenchmarks/DatabaseBenchmarks.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj index 3a197fb..e62a346 100644 --- a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj +++ b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj @@ -3,7 +3,7 @@ - + @@ -25,7 +25,7 @@ net6.0 11 iRLeagueDatabaseCore - 0.10.0-dev.3 + 0.10.0 Simon Schulze Simon Schulze This package contains the Entityframework configuration for a Code first project From 4489687b3aa5a6226658b440df169ec275b89a94 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Sun, 29 Oct 2023 02:49:33 +0200 Subject: [PATCH 6/6] fix build error due to RaceType int conversion --- src/DatabaseBenchmarks/Program.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DatabaseBenchmarks/Program.cs b/src/DatabaseBenchmarks/Program.cs index 476c86c..fa87b85 100644 --- a/src/DatabaseBenchmarks/Program.cs +++ b/src/DatabaseBenchmarks/Program.cs @@ -1,4 +1,5 @@ using BenchmarkDotNet.Attributes; +using iRLeagueApiCore.Common.Enums; using iRLeagueApiCore.Common.Models; using iRLeagueDatabaseCore.Models; using Microsoft.EntityFrameworkCore; @@ -213,7 +214,7 @@ public async Task SingleEventQuery() PositionChange = row.PositionChange, QualifyingTime = row.QualifyingTime, SeasonStartIrating = row.SeasonStartIRating, - Status = row.Status, + Status = (RaceStatus)row.Status, TeamId = row.TeamId }), CreatedOn = sessionResult.CreatedOn,