From 90efb91402baff397e7a3ca886a40b3206161517 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Wed, 23 Aug 2023 22:44:47 +0200 Subject: [PATCH 01/12] Replace FilterConditionEntity relation with single Json column --- src/iRLeagueDatabaseCore/ILeagueDbContext.cs | 1 - src/iRLeagueDatabaseCore/LeagueDbContext.cs | 3 - .../Models/FilterConditionEntity.cs | 70 +++++++++---------- .../Models/FilterOptionEntity.cs | 17 ++++- .../PopulateTestDatabase.cs | 15 +++- test/DbIntegrationTests/DbIntegrationTests.cs | 3 +- 6 files changed, 65 insertions(+), 44 deletions(-) diff --git a/src/iRLeagueDatabaseCore/ILeagueDbContext.cs b/src/iRLeagueDatabaseCore/ILeagueDbContext.cs index 5bee853..ee11f81 100644 --- a/src/iRLeagueDatabaseCore/ILeagueDbContext.cs +++ b/src/iRLeagueDatabaseCore/ILeagueDbContext.cs @@ -23,7 +23,6 @@ public interface ILeagueDbContext public DbSet ResultConfigurations { get; set; } public DbSet ResultRows { get; set; } public DbSet FilterOptions { get; set; } - public DbSet FilterConditions { get; set; } public DbSet ReviewPenaltys { get; set; } public DbSet Schedules { get; set; } public DbSet ScoredEventResults { get; set; } diff --git a/src/iRLeagueDatabaseCore/LeagueDbContext.cs b/src/iRLeagueDatabaseCore/LeagueDbContext.cs index 82ac689..5b0bf8e 100644 --- a/src/iRLeagueDatabaseCore/LeagueDbContext.cs +++ b/src/iRLeagueDatabaseCore/LeagueDbContext.cs @@ -35,7 +35,6 @@ public LeagueDbContext(DbContextOptions options, ILeagueProvide public virtual DbSet ResultConfigurations { get; set; } public virtual DbSet ResultRows { get; set; } public virtual DbSet FilterOptions { get; set; } - public virtual DbSet FilterConditions { get; set; } public virtual DbSet ReviewPenaltys { get; set; } public virtual DbSet Schedules { get; set; } public virtual DbSet ScoredEventResults { get; set; } @@ -110,8 +109,6 @@ 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/Models/FilterConditionEntity.cs b/src/iRLeagueDatabaseCore/Models/FilterConditionEntity.cs index f784d44..4c1f830 100644 --- a/src/iRLeagueDatabaseCore/Models/FilterConditionEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/FilterConditionEntity.cs @@ -1,47 +1,47 @@ -namespace iRLeagueDatabaseCore.Models; +//namespace iRLeagueDatabaseCore.Models; -public partial class FilterConditionEntity -{ - public FilterConditionEntity() - { - FilterValues = new HashSet(); - } +//public partial class FilterConditionEntity +//{ +// public FilterConditionEntity() +// { +// FilterValues = new HashSet(); +// } - public long LeagueId { get; set; } - public long ConditionId { get; set; } - public long FilterOptionId { get; set; } +// public long LeagueId { get; set; } +// public long ConditionId { get; set; } +// public long FilterOptionId { get; set; } - public FilterType FilterType { get; set; } - public string ColumnPropertyName { get; set; } - public ComparatorType Comparator { get; set; } - public MatchedValueAction Action { get; set; } +// public FilterType FilterType { get; set; } +// public string ColumnPropertyName { get; set; } +// public ComparatorType Comparator { get; set; } +// public MatchedValueAction Action { get; set; } - public virtual FilterOptionEntity FilterOption { get; set; } - public virtual ICollection FilterValues { get; set; } -} +// public virtual FilterOptionEntity FilterOption { get; set; } +// public virtual ICollection FilterValues { get; set; } +//} -public sealed class FilterConditionEntityConfiguration : IEntityTypeConfiguration -{ - public void Configure(EntityTypeBuilder entity) - { - entity.HasKey(e => new { e.LeagueId, e.ConditionId }); +//public sealed class FilterConditionEntityConfiguration : IEntityTypeConfiguration +//{ +// public void Configure(EntityTypeBuilder entity) +// { +// entity.HasKey(e => new { e.LeagueId, e.ConditionId }); - entity.HasAlternateKey(e => e.ConditionId); +// entity.HasAlternateKey(e => e.ConditionId); - entity.Property(e => e.ConditionId) - .ValueGeneratedOnAdd(); +// entity.Property(e => e.ConditionId) +// .ValueGeneratedOnAdd(); - entity.Property(e => e.FilterValues) - .HasConversion(new CollectionToStringConverter(), new ValueComparer>(true)); +// entity.Property(e => e.FilterValues) +// .HasConversion(new CollectionToStringConverter(), new ValueComparer>(true)); - entity.Property(e => e.FilterType).HasConversion>(); +// entity.Property(e => e.FilterType).HasConversion>(); - entity.Property(e => e.Comparator).HasConversion>(); +// entity.Property(e => e.Comparator).HasConversion>(); - entity.Property(e => e.Action).HasConversion>(); +// entity.Property(e => e.Action).HasConversion>(); - entity.HasOne(d => d.FilterOption) - .WithMany(p => p.Conditions) - .HasForeignKey(d => new { d.LeagueId, d.FilterOptionId }); - } -} +// entity.HasOne(d => d.FilterOption) +// .WithMany(p => p.Conditions) +// .HasForeignKey(d => new { d.LeagueId, d.FilterOptionId }); +// } +//} diff --git a/src/iRLeagueDatabaseCore/Models/FilterOptionEntity.cs b/src/iRLeagueDatabaseCore/Models/FilterOptionEntity.cs index 5410f90..948baec 100644 --- a/src/iRLeagueDatabaseCore/Models/FilterOptionEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/FilterOptionEntity.cs @@ -1,10 +1,13 @@ -namespace iRLeagueDatabaseCore.Models; +using iRLeagueApiCore.Common.Models; +using System.Text.Json; + +namespace iRLeagueDatabaseCore.Models; public partial class FilterOptionEntity : IVersionEntity { public FilterOptionEntity() { - Conditions = new HashSet(); + Conditions = new HashSet(); } public long LeagueId { get; set; } @@ -23,7 +26,7 @@ public FilterOptionEntity() #endregion public virtual ResultConfigurationEntity PointFilterResultConfig { get; set; } public virtual ResultConfigurationEntity ResultFilterResultConfig { get; set; } - public virtual ICollection Conditions { get; set; } + public virtual ICollection Conditions { get; set; } } public sealed class FilterOptionEntityConfiguration : IEntityTypeConfiguration @@ -41,6 +44,14 @@ public void Configure(EntityTypeBuilder entity) entity.Property(e => e.LastModifiedOn).HasColumnType("datetime"); + entity.Property(e => e.Conditions) + .HasColumnType("json") + .HasConversion( + v => JsonSerializer.Serialize(v, default(JsonSerializerOptions)), + v => JsonSerializer.Deserialize>(v, default(JsonSerializerOptions)), + new ValueComparer>(false)) + .IsRequired(true); + entity.HasOne(d => d.PointFilterResultConfig) .WithMany(p => p.PointFilters) .HasForeignKey(d => new { d.LeagueId, d.PointFilterResultConfigId }) diff --git a/src/iRLeagueDatabaseCore/PopulateTestDatabase.cs b/src/iRLeagueDatabaseCore/PopulateTestDatabase.cs index 12ce98f..5ea951f 100644 --- a/src/iRLeagueDatabaseCore/PopulateTestDatabase.cs +++ b/src/iRLeagueDatabaseCore/PopulateTestDatabase.cs @@ -1,4 +1,5 @@ -using iRLeagueDatabaseCore.Models; +using iRLeagueApiCore.Common.Models; +using iRLeagueDatabaseCore.Models; namespace DbIntegrationTests; @@ -237,10 +238,22 @@ public static void Populate(LeagueDbContext context, Random random) Season = season, }; championship.ChampSeasons.Add(champSeason); + var resultFilter = new FilterOptionEntity() + { + Conditions = new[] { new FilterConditionModel() + { + Action = MatchedValueAction.Remove, + ColumnPropertyName = "Shame", + Comparator = ComparatorType.ForEach, + FilterType = FilterType.Member, + FilterValues = new[] { "Eins", "Zwei", "Drei" }, + }}, + }; var resultConfig = new ResultConfigurationEntity() { League = league1, ChampSeason = champSeason, + ResultFilters = new[] { resultFilter }, }; league1.ResultConfigs.Add(resultConfig); for (int i = 0; i < 2; i++) diff --git a/test/DbIntegrationTests/DbIntegrationTests.cs b/test/DbIntegrationTests/DbIntegrationTests.cs index ffdf88e..4291730 100644 --- a/test/DbIntegrationTests/DbIntegrationTests.cs +++ b/test/DbIntegrationTests/DbIntegrationTests.cs @@ -1,4 +1,5 @@ using FluentAssertions; +using iRLeagueApiCore.Common.Models; using iRLeagueDatabaseCore.Models; using Microsoft.EntityFrameworkCore; using System; @@ -225,7 +226,7 @@ public async Task ShouldSetFilterValues() var filterOption = new FilterOptionEntity() { Conditions = new[] { - new FilterConditionEntity() { FilterValues = new[] { "Value1", "Value2" } }, + new FilterConditionModel() { FilterValues = new[] { "Value1", "Value2" } }, }, }; var config = await context.ResultConfigurations.FirstAsync(); From f3ede93e620986d723e7cdaf3b49bd7d63577abb Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Wed, 23 Aug 2023 23:05:20 +0200 Subject: [PATCH 02/12] Create migration for json column --- .../MigrationUseJsonFiltersOnResultConfig.sql | 89 + ...2_UseJsonFiltersOnResultConfig.Designer.cs | 3848 +++++++++++++++++ ...0822204602_UseJsonFiltersOnResultConfig.cs | 140 + .../LeagueDbContextModelSnapshot.cs | 59 +- 4 files changed, 4081 insertions(+), 55 deletions(-) create mode 100644 src/iRLeagueDatabaseCore/MigrationUseJsonFiltersOnResultConfig.sql create mode 100644 src/iRLeagueDatabaseCore/Migrations/20230822204602_UseJsonFiltersOnResultConfig.Designer.cs create mode 100644 src/iRLeagueDatabaseCore/Migrations/20230822204602_UseJsonFiltersOnResultConfig.cs diff --git a/src/iRLeagueDatabaseCore/MigrationUseJsonFiltersOnResultConfig.sql b/src/iRLeagueDatabaseCore/MigrationUseJsonFiltersOnResultConfig.sql new file mode 100644 index 0000000..b0643c7 --- /dev/null +++ b/src/iRLeagueDatabaseCore/MigrationUseJsonFiltersOnResultConfig.sql @@ -0,0 +1,89 @@ +/* Migrate the filterOptionEntity used on ResultConfigs to use json column for Conditions + * instead of previous FilterConditionEntity + */ + +USE TestDatabase; + +START TRANSACTION; + +-- Pre migration +-- Create Temporary table holding the filter conditions before dropping table +CREATE TEMPORARY TABLE TmpFilterConditions ( + LeagueId BIGINT NOT NULL, + ConditionId BIGINT NOT NULL, + FilterOptionId BIGINT NOT NULL, + FilterType LONGTEXT NOT NULL, + ColumnPropertyName LONGTEXT NULL, + Comparator LONGTEXT NOT NULL, + `Action` LONGTEXT NOT NULL, + FilterValues LONGTEXT NULL, + PRIMARY KEY (LeagueId, ConditionId) +); + +INSERT INTO TmpFilterConditions (LeagueId, ConditionId, FilterOptionId, FilterType, ColumnPropertyName, Comparator, Action, FilterValues) + SELECT LeagueId, ConditionId, FilterOptionId, FilterType, ColumnPropertyName, Comparator, Action, FilterValues + FROM FilterConditions; + +-- Post migration +-- Create function to convert Filter values from single string into json array +DELIMITER // + +DROP FUNCTION IF EXISTS splitStringToJsonArray; + +CREATE FUNCTION splitStringToJsonArray( + inputString TEXT, + delimiterChar CHAR(1)) + RETURNS TEXT + DETERMINISTIC +BEGIN + DECLARE temp_string TEXT; + SET temp_string = '["'; + WHILE LOCATE(delimiterChar,inputString) > 1 DO + SET temp_string = CONCAT(temp_string, SUBSTRING_INDEX(inputString,delimiterChar,1), '","'); + SET inputString = REGEXP_REPLACE(inputString, ( + SELECT LEFT(inputString, LOCATE(delimiterChar, inputString)) + ),'',1,1); + END WHILE; + SET temp_string = CONCAT(temp_string, inputString, '"]'); + RETURN temp_string; +END; // + +DELIMITER ; + +-- Populate `Conditions` column with stored values and perform necessary value conversions +UPDATE FilterOptions AS f + JOIN (SELECT FilterOptionId, + CASE FilterType + WHEN 'ColumnProperty' THEN 0 + WHEN 'Member' THEN 1 + WHEN 'Team' THEN 2 + END AS FilterType, + ColumnPropertyName, + CASE Comparator + WHEN 'IsSmaller' THEN 0 + WHEN 'IsSmallerOrEqual' THEN 1 + WHEN 'IsEqual' THEN 2 + WHEN 'IsBiggerOrEqual' THEN 3 + WHEN 'IsBigger' THEN 4 + WHEN 'NotEqual' THEN 5 + WHEN 'InList' THEN 6 + WHEN 'ForEach' THEN 7 + END AS Comparator, + CASE `Action` + WHEN 'Keep' THEN 0 + WHEN 'Remove' THEN 1 + END AS `Action`, + FilterValues + FROM TmpFilterConditions) AS fc + ON fc.FilterOptionId = f.FilterOptionId + SET f.Conditions = CONCAT( + '[{"Action": ', fc.`Action`, + ', "Comparator": ', fc.Comparator, + ', "FilterType": ', fc.FilterType, + ', "FilterValues": ', splitStringToJsonArray(fc.FilterValues, ';'), + ', "ColumnPropertyName": "', fc.ColumnPropertyName, '"}]'); + +DROP TABLE TmpFilterConditions; +DROP FUNCTION splitStringToJsonArray; + +ROLLBACK; \ No newline at end of file diff --git a/src/iRLeagueDatabaseCore/Migrations/20230822204602_UseJsonFiltersOnResultConfig.Designer.cs b/src/iRLeagueDatabaseCore/Migrations/20230822204602_UseJsonFiltersOnResultConfig.Designer.cs new file mode 100644 index 0000000..449cb5c --- /dev/null +++ b/src/iRLeagueDatabaseCore/Migrations/20230822204602_UseJsonFiltersOnResultConfig.Designer.cs @@ -0,0 +1,3848 @@ +// +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("20230822204602_UseJsonFiltersOnResultConfig")] + partial class UseJsonFiltersOnResultConfig + { + 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("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", "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("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("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", "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.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("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("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") + .HasColumnType("longtext"); + + 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("ResultKind") + .IsRequired() + .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("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", "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("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("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.VoteCategoryEntity", "VoteCategory") + .WithMany("AcceptedReviewVotes") + .HasForeignKey("LeagueId", "VoteCategoryId"); + + b.Navigation("MemberAtFault"); + + b.Navigation("Review"); + + 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.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("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.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.VoteCategoryEntity", "VoteCategory") + .WithMany("CommentReviewVotes") + .HasForeignKey("LeagueId", "VoteCategoryId"); + + b.Navigation("Comment"); + + b.Navigation("MemberAtFault"); + + 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("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/20230822204602_UseJsonFiltersOnResultConfig.cs b/src/iRLeagueDatabaseCore/Migrations/20230822204602_UseJsonFiltersOnResultConfig.cs new file mode 100644 index 0000000..17271e5 --- /dev/null +++ b/src/iRLeagueDatabaseCore/Migrations/20230822204602_UseJsonFiltersOnResultConfig.cs @@ -0,0 +1,140 @@ +using Microsoft.EntityFrameworkCore.Migrations; +using MySql.EntityFrameworkCore.Metadata; + +#nullable disable + +namespace iRLeagueDatabaseCore.Migrations +{ + public partial class UseJsonFiltersOnResultConfig : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.Sql(@" + -- Pre migration + -- Create Temporary table holding the filter conditions before dropping table + CREATE TEMPORARY TABLE TmpFilterConditions ( + LeagueId BIGINT NOT NULL, + ConditionId BIGINT NOT NULL, + FilterOptionId BIGINT NOT NULL, + FilterType LONGTEXT NOT NULL, + ColumnPropertyName LONGTEXT NULL, + Comparator LONGTEXT NOT NULL, + `Action` LONGTEXT NOT NULL, + FilterValues LONGTEXT NULL, + PRIMARY KEY (LeagueId, ConditionId) + ); + + INSERT INTO TmpFilterConditions (LeagueId, ConditionId, FilterOptionId, FilterType, ColumnPropertyName, Comparator, Action, FilterValues) + SELECT LeagueId, ConditionId, FilterOptionId, FilterType, ColumnPropertyName, Comparator, Action, FilterValues + FROM FilterConditions; + "); + + migrationBuilder.DropTable( + name: "FilterConditions"); + + migrationBuilder.AddColumn( + name: "Conditions", + table: "FilterOptions", + type: "json", + nullable: false); + + migrationBuilder.Sql(@" + -- Post migration + -- Create function to convert Filter values from single string into json array + DROP FUNCTION IF EXISTS splitStringToJsonArray; + + CREATE FUNCTION splitStringToJsonArray( + inputString TEXT, + delimiterChar CHAR(1)) + RETURNS TEXT + DETERMINISTIC + BEGIN + DECLARE temp_string TEXT; + SET temp_string = '[""'; + WHILE LOCATE(delimiterChar,inputString) > 1 DO + SET temp_string = CONCAT(temp_string, SUBSTRING_INDEX(inputString,delimiterChar,1), '"",""'); + SET inputString = REGEXP_REPLACE(inputString, ( + SELECT LEFT(inputString, LOCATE(delimiterChar, inputString)) + ),'',1,1); + END WHILE; + SET temp_string = CONCAT(temp_string, inputString, '""]'); + RETURN temp_string; + END; + + -- Populate `Conditions` column with stored values and perform necessary value conversions + UPDATE FilterOptions AS f + JOIN (SELECT FilterOptionId, + CASE FilterType + WHEN 'ColumnProperty' THEN 0 + WHEN 'Member' THEN 1 + WHEN 'Team' THEN 2 + END AS FilterType, + ColumnPropertyName, + CASE Comparator + WHEN 'IsSmaller' THEN 0 + WHEN 'IsSmallerOrEqual' THEN 1 + WHEN 'IsEqual' THEN 2 + WHEN 'IsBiggerOrEqual' THEN 3 + WHEN 'IsBigger' THEN 4 + WHEN 'NotEqual' THEN 5 + WHEN 'InList' THEN 6 + WHEN 'ForEach' THEN 7 + END AS Comparator, + CASE `Action` + WHEN 'Keep' THEN 0 + WHEN 'Remove' THEN 1 + END AS `Action`, + FilterValues + FROM TmpFilterConditions) AS fc + ON fc.FilterOptionId = f.FilterOptionId + SET f.Conditions = CONCAT( + '[{""Action"": ', fc.`Action`, + ', ""Comparator"": ', fc.Comparator, + ', ""FilterType"": ', fc.FilterType, + ', ""FilterValues"": ', splitStringToJsonArray(fc.FilterValues, ';'), + ', ""ColumnPropertyName"": ""', fc.ColumnPropertyName, '""}]'); + + DROP TABLE TmpFilterConditions; + DROP FUNCTION splitStringToJsonArray; + "); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Conditions", + table: "FilterOptions"); + + migrationBuilder.CreateTable( + name: "FilterConditions", + columns: table => new + { + LeagueId = table.Column(type: "bigint", nullable: false), + ConditionId = table.Column(type: "bigint", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + FilterOptionId = table.Column(type: "bigint", nullable: false), + Action = table.Column(type: "longtext", nullable: false), + ColumnPropertyName = table.Column(type: "longtext", nullable: true), + Comparator = table.Column(type: "longtext", nullable: false), + FilterType = table.Column(type: "longtext", nullable: false), + FilterValues = table.Column(type: "longtext", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_FilterConditions", x => new { x.LeagueId, x.ConditionId }); + table.UniqueConstraint("AK_FilterConditions_ConditionId", x => x.ConditionId); + table.ForeignKey( + name: "FK_FilterConditions_FilterOptions_LeagueId_FilterOptionId", + columns: x => new { x.LeagueId, x.FilterOptionId }, + principalTable: "FilterOptions", + principalColumns: new[] { "LeagueId", "FilterOptionId" }, + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_FilterConditions_LeagueId_FilterOptionId", + table: "FilterConditions", + columns: new[] { "LeagueId", "FilterOptionId" }); + } + } +} diff --git a/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs b/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs index 76affca..7a700c7 100644 --- a/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs +++ b/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs @@ -640,45 +640,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("EventResults"); }); - modelBuilder.Entity("iRLeagueDatabaseCore.Models.FilterConditionEntity", b => - { - b.Property("LeagueId") - .HasColumnType("bigint"); - - b.Property("ConditionId") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("Action") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ColumnPropertyName") - .HasColumnType("longtext"); - - b.Property("Comparator") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FilterOptionId") - .HasColumnType("bigint"); - - b.Property("FilterType") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FilterValues") - .HasColumnType("longtext"); - - b.HasKey("LeagueId", "ConditionId"); - - b.HasAlternateKey("ConditionId"); - - b.HasIndex("LeagueId", "FilterOptionId"); - - b.ToTable("FilterConditions"); - }); - modelBuilder.Entity("iRLeagueDatabaseCore.Models.FilterOptionEntity", b => { b.Property("LeagueId") @@ -688,6 +649,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + b.Property("Conditions") + .IsRequired() + .HasColumnType("json"); + b.Property("CreatedByUserId") .HasColumnType("longtext"); @@ -3033,17 +2998,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Event"); }); - modelBuilder.Entity("iRLeagueDatabaseCore.Models.FilterConditionEntity", b => - { - b.HasOne("iRLeagueDatabaseCore.Models.FilterOptionEntity", "FilterOption") - .WithMany("Conditions") - .HasForeignKey("LeagueId", "FilterOptionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FilterOption"); - }); - modelBuilder.Entity("iRLeagueDatabaseCore.Models.FilterOptionEntity", b => { b.HasOne("iRLeagueDatabaseCore.Models.ResultConfigurationEntity", "PointFilterResultConfig") @@ -3715,11 +3669,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("SessionResults"); }); - modelBuilder.Entity("iRLeagueDatabaseCore.Models.FilterOptionEntity", b => - { - b.Navigation("Conditions"); - }); - modelBuilder.Entity("iRLeagueDatabaseCore.Models.IncidentReviewEntity", b => { b.Navigation("AcceptedReviewVotes"); From 42924b3dc8dc491373a3d0ced8e523f02b487da0 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Fri, 25 Aug 2023 20:55:04 +0200 Subject: [PATCH 03/12] bump dev version --- src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj index 537d5d3..f2aeaad 100644 --- a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj +++ b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj @@ -24,7 +24,7 @@ Library net6.0 iRLeagueDatabaseCore - 0.8.0 + 0.9.0-dev.1 Simon Schulze Simon Schulze This package contains the Entityframework configuration for a Code first project From 9b3bb56ce3603c7dcbb9252d4c983ccd103c1fa8 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Mon, 28 Aug 2023 23:50:32 +0200 Subject: [PATCH 04/12] Add filterOptions for ChampSeason --- .../MigrationFiltersForChampSeason.sql | 18 + ...5195540_FiltersForChampSeasons.Designer.cs | 3862 +++++++++++++++++ .../20230825195540_FiltersForChampSeasons.cs | 45 + .../LeagueDbContextModelSnapshot.cs | 14 + .../Models/ChampSeasonEntity.cs | 1 + .../Models/FilterOptionEntity.cs | 8 + .../iRLeagueDatabaseCore.csproj | 2 +- 7 files changed, 3949 insertions(+), 1 deletion(-) create mode 100644 src/iRLeagueDatabaseCore/MigrationFiltersForChampSeason.sql create mode 100644 src/iRLeagueDatabaseCore/Migrations/20230825195540_FiltersForChampSeasons.Designer.cs create mode 100644 src/iRLeagueDatabaseCore/Migrations/20230825195540_FiltersForChampSeasons.cs diff --git a/src/iRLeagueDatabaseCore/MigrationFiltersForChampSeason.sql b/src/iRLeagueDatabaseCore/MigrationFiltersForChampSeason.sql new file mode 100644 index 0000000..a285e12 --- /dev/null +++ b/src/iRLeagueDatabaseCore/MigrationFiltersForChampSeason.sql @@ -0,0 +1,18 @@ +/* Migrate the filterOptionEntity used on ResultConfigs to use json column for Conditions + * instead of previous FilterConditionEntity + */ + +USE TestDatabase; + +START TRANSACTION; + +-- Populate `Conditions` column with stored values and perform necessary value conversions +UPDATE FilterOptions AS f + JOIN ResultConfigurations AS rc + on rc.ResultConfigId=f.ResultFilterResultConfigId + SET f.ChampSeasonId = rc.ChampSeasonId; + +DROP TABLE TmpFilterConditions; +DROP FUNCTION splitStringToJsonArray; + +ROLLBACK; \ No newline at end of file diff --git a/src/iRLeagueDatabaseCore/Migrations/20230825195540_FiltersForChampSeasons.Designer.cs b/src/iRLeagueDatabaseCore/Migrations/20230825195540_FiltersForChampSeasons.Designer.cs new file mode 100644 index 0000000..82bbb72 --- /dev/null +++ b/src/iRLeagueDatabaseCore/Migrations/20230825195540_FiltersForChampSeasons.Designer.cs @@ -0,0 +1,3862 @@ +// +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("20230825195540_FiltersForChampSeasons")] + partial class FiltersForChampSeasons + { + 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("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", "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("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.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("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("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") + .HasColumnType("longtext"); + + 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("ResultKind") + .IsRequired() + .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("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", "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("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("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.VoteCategoryEntity", "VoteCategory") + .WithMany("AcceptedReviewVotes") + .HasForeignKey("LeagueId", "VoteCategoryId"); + + b.Navigation("MemberAtFault"); + + b.Navigation("Review"); + + 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.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.VoteCategoryEntity", "VoteCategory") + .WithMany("CommentReviewVotes") + .HasForeignKey("LeagueId", "VoteCategoryId"); + + b.Navigation("Comment"); + + b.Navigation("MemberAtFault"); + + 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/20230825195540_FiltersForChampSeasons.cs b/src/iRLeagueDatabaseCore/Migrations/20230825195540_FiltersForChampSeasons.cs new file mode 100644 index 0000000..507782b --- /dev/null +++ b/src/iRLeagueDatabaseCore/Migrations/20230825195540_FiltersForChampSeasons.cs @@ -0,0 +1,45 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace iRLeagueDatabaseCore.Migrations +{ + public partial class FiltersForChampSeasons : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ChampSeasonId", + table: "FilterOptions", + type: "bigint", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_FilterOptions_LeagueId_ChampSeasonId", + table: "FilterOptions", + columns: new[] { "LeagueId", "ChampSeasonId" }); + + migrationBuilder.AddForeignKey( + name: "FK_FilterOptions_ChampSeasons_LeagueId_ChampSeasonId", + table: "FilterOptions", + columns: new[] { "LeagueId", "ChampSeasonId" }, + principalTable: "ChampSeasons", + principalColumns: new[] { "LeagueId", "ChampSeasonId" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_FilterOptions_ChampSeasons_LeagueId_ChampSeasonId", + table: "FilterOptions"); + + migrationBuilder.DropIndex( + name: "IX_FilterOptions_LeagueId_ChampSeasonId", + table: "FilterOptions"); + + migrationBuilder.DropColumn( + name: "ChampSeasonId", + table: "FilterOptions"); + } + } +} diff --git a/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs b/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs index 7a700c7..c7aa115 100644 --- a/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs +++ b/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs @@ -649,6 +649,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + b.Property("ChampSeasonId") + .HasColumnType("bigint"); + b.Property("Conditions") .IsRequired() .HasColumnType("json"); @@ -684,6 +687,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasAlternateKey("FilterOptionId"); + b.HasIndex("LeagueId", "ChampSeasonId"); + b.HasIndex("LeagueId", "PointFilterResultConfigId"); b.HasIndex("LeagueId", "ResultFilterResultConfigId"); @@ -3000,6 +3005,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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") @@ -3010,6 +3020,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("LeagueId", "ResultFilterResultConfigId") .OnDelete(DeleteBehavior.ClientCascade); + b.Navigation("ChampSeason"); + b.Navigation("PointFilterResultConfig"); b.Navigation("ResultFilterResultConfig"); @@ -3646,6 +3658,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Navigation("EventResults"); + b.Navigation("Filters"); + b.Navigation("ResultConfigurations"); b.Navigation("Standings"); diff --git a/src/iRLeagueDatabaseCore/Models/ChampSeasonEntity.cs b/src/iRLeagueDatabaseCore/Models/ChampSeasonEntity.cs index b4acf6c..7daa938 100644 --- a/src/iRLeagueDatabaseCore/Models/ChampSeasonEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/ChampSeasonEntity.cs @@ -25,6 +25,7 @@ public ChampSeasonEntity() public virtual StandingConfigurationEntity StandingConfiguration { get; set; } public virtual IEnumerable EventResults { get; set; } public virtual IEnumerable Standings { get; set; } + public virtual ICollection Filters { get; set; } #region version public DateTime? CreatedOn { get; set; } diff --git a/src/iRLeagueDatabaseCore/Models/FilterOptionEntity.cs b/src/iRLeagueDatabaseCore/Models/FilterOptionEntity.cs index 948baec..5253fc5 100644 --- a/src/iRLeagueDatabaseCore/Models/FilterOptionEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/FilterOptionEntity.cs @@ -14,6 +14,7 @@ public FilterOptionEntity() public long FilterOptionId { get; set; } public long? PointFilterResultConfigId { get; set; } public long? ResultFilterResultConfigId { get; set; } + public long? ChampSeasonId { get; set; } #region version public DateTime? CreatedOn { get; set; } @@ -26,6 +27,7 @@ public FilterOptionEntity() #endregion public virtual ResultConfigurationEntity PointFilterResultConfig { get; set; } public virtual ResultConfigurationEntity ResultFilterResultConfig { get; set; } + public virtual ChampSeasonEntity ChampSeason { get; set; } public virtual ICollection Conditions { get; set; } } @@ -63,5 +65,11 @@ public void Configure(EntityTypeBuilder entity) .HasForeignKey(d => new { d.LeagueId, d.ResultFilterResultConfigId }) .IsRequired(false) .OnDelete(DeleteBehavior.ClientCascade); + + entity.HasOne(d => d.ChampSeason) + .WithMany(p => p.Filters) + .HasForeignKey(d => new { d.LeagueId, d.ChampSeasonId }) + .IsRequired(false) + .OnDelete(DeleteBehavior.ClientCascade); } } diff --git a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj index f2aeaad..0fabdaa 100644 --- a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj +++ b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj @@ -24,7 +24,7 @@ Library net6.0 iRLeagueDatabaseCore - 0.9.0-dev.1 + 0.9.0-dev.2 Simon Schulze Simon Schulze This package contains the Entityframework configuration for a Code first project From dbda50c8ae989952ff62ea0b907a4b0d220b442e Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Tue, 29 Aug 2023 21:24:18 +0200 Subject: [PATCH 05/12] Create migration to move filters from result configs to champ seasons --- .../MigrationFiltersForChampSeason.sql | 12 +++++++----- .../20230825195540_FiltersForChampSeasons.cs | 12 ++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/iRLeagueDatabaseCore/MigrationFiltersForChampSeason.sql b/src/iRLeagueDatabaseCore/MigrationFiltersForChampSeason.sql index a285e12..9a4035d 100644 --- a/src/iRLeagueDatabaseCore/MigrationFiltersForChampSeason.sql +++ b/src/iRLeagueDatabaseCore/MigrationFiltersForChampSeason.sql @@ -9,10 +9,12 @@ START TRANSACTION; -- Populate `Conditions` column with stored values and perform necessary value conversions UPDATE FilterOptions AS f JOIN ResultConfigurations AS rc - on rc.ResultConfigId=f.ResultFilterResultConfigId - SET f.ChampSeasonId = rc.ChampSeasonId; - -DROP TABLE TmpFilterConditions; -DROP FUNCTION splitStringToJsonArray; + ON rc.ResultConfigId=f.ResultFilterResultConfigId + JOIN ChampSeasons AS cs + ON cs.ChampSeasonId=rc.ChampSeasonId + JOIN Seasons AS s + ON cs.SeasonId=s.SeasonId + WHERE s.Finished=0 AND cs.IsActive + SET f.ChampSeasonId = rc.ChampSeasonId, f.ResultFilterResultConfigId=NULL; ROLLBACK; \ No newline at end of file diff --git a/src/iRLeagueDatabaseCore/Migrations/20230825195540_FiltersForChampSeasons.cs b/src/iRLeagueDatabaseCore/Migrations/20230825195540_FiltersForChampSeasons.cs index 507782b..67abae8 100644 --- a/src/iRLeagueDatabaseCore/Migrations/20230825195540_FiltersForChampSeasons.cs +++ b/src/iRLeagueDatabaseCore/Migrations/20230825195540_FiltersForChampSeasons.cs @@ -25,6 +25,18 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: new[] { "LeagueId", "ChampSeasonId" }, principalTable: "ChampSeasons", principalColumns: new[] { "LeagueId", "ChampSeasonId" }); + + migrationBuilder.Sql(@" + UPDATE FilterOptions AS f + JOIN ResultConfigurations AS rc + ON rc.ResultConfigId=f.ResultFilterResultConfigId + JOIN ChampSeasons AS cs + ON cs.ChampSeasonId=rc.ChampSeasonId + JOIN Seasons AS s + ON cs.SeasonId=s.SeasonId + SET f.ChampSeasonId = rc.ChampSeasonId, f.ResultFilterResultConfigId=NULL + WHERE s.Finished=0 AND cs.IsActive; + "); } protected override void Down(MigrationBuilder migrationBuilder) From 54bfa26e1700d10c121a1435686f2b998d8026e3 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Tue, 29 Aug 2023 21:24:33 +0200 Subject: [PATCH 06/12] Fix missing default constructor for Filters --- src/iRLeagueDatabaseCore/Models/ChampSeasonEntity.cs | 1 + src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/iRLeagueDatabaseCore/Models/ChampSeasonEntity.cs b/src/iRLeagueDatabaseCore/Models/ChampSeasonEntity.cs index 7daa938..dd12532 100644 --- a/src/iRLeagueDatabaseCore/Models/ChampSeasonEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/ChampSeasonEntity.cs @@ -8,6 +8,7 @@ public ChampSeasonEntity() ResultConfigurations = new HashSet(); EventResults = new HashSet(); Standings = new HashSet(); + Filters = new HashSet(); } public long LeagueId { get; set; } diff --git a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj index 0fabdaa..891d601 100644 --- a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj +++ b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj @@ -24,7 +24,7 @@ Library net6.0 iRLeagueDatabaseCore - 0.9.0-dev.2 + 0.9.0-dev.3 Simon Schulze Simon Schulze This package contains the Entityframework configuration for a Code first project From c001f1e2fedd7b1a93eb0584282d6e530c51005a Mon Sep 17 00:00:00 2001 From: Simon Schulze <57634354+SSchulze1989@users.noreply.github.com> Date: Mon, 4 Sep 2023 07:04:46 +0000 Subject: [PATCH 07/12] Add columns for races scored --- .devcontainer/devcontainer.json | 27 + .../20230904070324_AddRacesScored.Designer.cs | 3868 +++++++++++++++++ .../20230904070324_AddRacesScored.cs | 37 + .../LeagueDbContextModelSnapshot.cs | 6 + .../Models/StandingRowEntity.cs | 2 + .../iRLeagueDatabaseCore.csproj | 2 +- 6 files changed, 3941 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 src/iRLeagueDatabaseCore/Migrations/20230904070324_AddRacesScored.Designer.cs create mode 100644 src/iRLeagueDatabaseCore/Migrations/20230904070324_AddRacesScored.cs diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..b2fbe3a --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,27 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet +{ + "name": "C# (.NET)", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/dotnet:0-6.0" + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [5000, 5001], + // "portsAttributes": { + // "5001": { + // "protocol": "https" + // } + // } + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "dotnet restore", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/src/iRLeagueDatabaseCore/Migrations/20230904070324_AddRacesScored.Designer.cs b/src/iRLeagueDatabaseCore/Migrations/20230904070324_AddRacesScored.Designer.cs new file mode 100644 index 0000000..5180738 --- /dev/null +++ b/src/iRLeagueDatabaseCore/Migrations/20230904070324_AddRacesScored.Designer.cs @@ -0,0 +1,3868 @@ +// +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("20230904070324_AddRacesScored")] + partial class AddRacesScored + { + 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("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", "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("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.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("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("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") + .HasColumnType("longtext"); + + 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("ResultKind") + .IsRequired() + .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("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", "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("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.VoteCategoryEntity", "VoteCategory") + .WithMany("AcceptedReviewVotes") + .HasForeignKey("LeagueId", "VoteCategoryId"); + + b.Navigation("MemberAtFault"); + + b.Navigation("Review"); + + 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.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.VoteCategoryEntity", "VoteCategory") + .WithMany("CommentReviewVotes") + .HasForeignKey("LeagueId", "VoteCategoryId"); + + b.Navigation("Comment"); + + b.Navigation("MemberAtFault"); + + 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/20230904070324_AddRacesScored.cs b/src/iRLeagueDatabaseCore/Migrations/20230904070324_AddRacesScored.cs new file mode 100644 index 0000000..9d3a59d --- /dev/null +++ b/src/iRLeagueDatabaseCore/Migrations/20230904070324_AddRacesScored.cs @@ -0,0 +1,37 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace iRLeagueDatabaseCore.Migrations +{ + public partial class AddRacesScored : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "RacesInPoints", + table: "StandingRows", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "RacesScored", + table: "StandingRows", + type: "int", + nullable: false, + defaultValue: 0); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "RacesInPoints", + table: "StandingRows"); + + migrationBuilder.DropColumn( + name: "RacesScored", + table: "StandingRows"); + } + } +} diff --git a/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs b/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs index c7aa115..3e2d3a8 100644 --- a/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs +++ b/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs @@ -2426,6 +2426,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("RacesCounted") .HasColumnType("int"); + b.Property("RacesInPoints") + .HasColumnType("int"); + + b.Property("RacesScored") + .HasColumnType("int"); + b.Property("StandingId") .HasColumnType("bigint"); diff --git a/src/iRLeagueDatabaseCore/Models/StandingRowEntity.cs b/src/iRLeagueDatabaseCore/Models/StandingRowEntity.cs index 3ded17c..7ccc026 100644 --- a/src/iRLeagueDatabaseCore/Models/StandingRowEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/StandingRowEntity.cs @@ -25,6 +25,8 @@ public StandingRowEntity() public int TotalPointsChange { get; set; } public int Races { get; set; } public int RacesCounted { get; set; } + public int RacesScored { get; set; } + public int RacesInPoints { get; set; } public int DroppedResultCount { get; set; } public int CompletedLaps { get; set; } public int CompletedLapsChange { get; set; } diff --git a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj index 891d601..fff6666 100644 --- a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj +++ b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj @@ -24,7 +24,7 @@ Library net6.0 iRLeagueDatabaseCore - 0.9.0-dev.3 + 0.9.0-dev.4 Simon Schulze Simon Schulze This package contains the Entityframework configuration for a Code first project From 5461f898cc26a8e8f80499cebeb8b78fbd031da0 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Mon, 4 Sep 2023 20:11:53 +0200 Subject: [PATCH 08/12] Change column type for bonus points to enable complex definitions --- .../DatabaseBenchmarks.csproj | 2 +- ...rationChangeBonusPointColumnTypeToJson.sql | 94 + ...angeBonusPointColumnTypeToJson.Designer.cs | 3863 +++++++++++++++++ ...210711_ChangeBonusPointColumnTypeToJson.cs | 115 + .../LeagueDbContextModelSnapshot.cs | 3 +- .../Models/PointRuleEntity.cs | 14 +- .../PopulateTestDatabase.cs | 8 +- .../iRLeagueDatabaseCore.csproj | 2 +- 8 files changed, 4091 insertions(+), 10 deletions(-) create mode 100644 src/iRLeagueDatabaseCore/MigrationChangeBonusPointColumnTypeToJson.sql create mode 100644 src/iRLeagueDatabaseCore/Migrations/20230831210711_ChangeBonusPointColumnTypeToJson.Designer.cs create mode 100644 src/iRLeagueDatabaseCore/Migrations/20230831210711_ChangeBonusPointColumnTypeToJson.cs diff --git a/src/DatabaseBenchmarks/DatabaseBenchmarks.csproj b/src/DatabaseBenchmarks/DatabaseBenchmarks.csproj index aa6cfad..947b7ef 100644 --- a/src/DatabaseBenchmarks/DatabaseBenchmarks.csproj +++ b/src/DatabaseBenchmarks/DatabaseBenchmarks.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/iRLeagueDatabaseCore/MigrationChangeBonusPointColumnTypeToJson.sql b/src/iRLeagueDatabaseCore/MigrationChangeBonusPointColumnTypeToJson.sql new file mode 100644 index 0000000..b3f1289 --- /dev/null +++ b/src/iRLeagueDatabaseCore/MigrationChangeBonusPointColumnTypeToJson.sql @@ -0,0 +1,94 @@ +/* Migrate the filterOptionEntity used on ResultConfigs to use json column for Conditions + * instead of previous FilterConditionEntity + */ + +USE TestDatabase; + +SET autocommit=0; +START TRANSACTION; + +-- Pre migration +-- Create Temporary table holding the bonus points before changing column type +CREATE TEMPORARY TABLE TmpBonusPoints ( + LeagueId BIGINT NOT NULL, + PointRuleId BIGINT NOT NULL PRIMARY KEY, + BonusPoints TEXT +); + +INSERT INTO TmpBonusPoints (LeagueId, PointRuleId, BonusPoints) + SELECT LeagueId, PointRuleId, BonusPoints + FROM PointRules; + +UPDATE PointRules + SET BonusPoints='[]'; + +-- Post migration +-- Create function to convert bonus values from single string into json array +DELIMITER // + +DROP FUNCTION IF EXISTS splitStringToBonusPoints; + +CREATE FUNCTION splitStringToBonusPoints(inputString TEXT, + pointDelimiter TEXT) + RETURNS TEXT + DETERMINISTIC +BEGIN + DECLARE bonusType TEXT; + DECLARE bonusValue TEXT; + DECLARE bonusPoints TEXT; + SET bonusType = SUBSTRING_INDEX(inputString,pointDelimiter,1); + SET bonusPoints = SUBSTRING(SUBSTRING_INDEX(inputString,pointDelimiter,2), LENGTH(bonusType)+2, 10); + SET bonusValue = IF(LENGTH(bonusType)>1, SUBSTRING(bonusType, 2, 10), '0'); + SET bonusType = SUBSTRING(bonusType, 1, 1); + SET bonusType = CASE bonusType + WHEN 'p' THEN '0' + WHEN 'q' THEN '1' + WHEN 'f' THEN '2' + WHEN 'a' THEN '3' + WHEN 'c' THEN '4' + WHEN 'n' THEN '5' + WHEN 'g' THEN '6' + WHEN 'd' THEN '7' + WHEN 'l' THEN '8' + WHEN 'm' THEN '9' + END; + RETURN CONCAT('{"Type":',bonusType,',"Value":',bonusValue,',"Points":',bonusPoints,',"Conditions":[]}'); +END; + +DROP FUNCTION IF EXISTS splitToArray; + +CREATE FUNCTION splitToArray( + inputString TEXT, + arrayDelimiter TEXT, + pointDelimiter TEXT) + RETURNS TEXT + DETERMINISTIC +BEGIN + DECLARE tempString TEXT; + SET tempString = '['; + WHILE LOCATE(arrayDelimiter,inputString) > 1 DO + SET tempString = CONCAT(tempString, splitStringToBonusPoints(SUBSTRING_INDEX(inputString,arrayDelimiter,1), pointDelimiter), ','); + SET inputString = REGEXP_REPLACE(inputString, ( + SELECT LEFT(inputString, LOCATE(arrayDelimiter, inputString)) + ),'',1,1); + END WHILE; + SET tempString = CONCAT(tempString, splitStringToBonusPoints(SUBSTRING_INDEX(inputString,arrayDelimiter,1), pointDelimiter), ']'); + RETURN tempString; +END; // + +DELIMITER ; + +-- Populate `Conditions` column with stored values and perform necessary value conversions +UPDATE TmpBonusPoints + SET BonusPoints = splitToArray(BonusPoints, ';', ':'); +UPDATE PointRules AS pr + JOIN TmpBonusPoints AS tmp + ON tmp.PointRuleId=pr.PointRuleId + SET pr.BonusPoints = tmp.BonusPoints + WHERE tmp.BonusPoints IS NOT NULL; + +DROP TABLE TmpBonusPoints; +DROP FUNCTION splitToArray; +DROP FUNCTION splitStringToBonusPoints; + +ROLLBACK; \ No newline at end of file diff --git a/src/iRLeagueDatabaseCore/Migrations/20230831210711_ChangeBonusPointColumnTypeToJson.Designer.cs b/src/iRLeagueDatabaseCore/Migrations/20230831210711_ChangeBonusPointColumnTypeToJson.Designer.cs new file mode 100644 index 0000000..02e62b9 --- /dev/null +++ b/src/iRLeagueDatabaseCore/Migrations/20230831210711_ChangeBonusPointColumnTypeToJson.Designer.cs @@ -0,0 +1,3863 @@ +// +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("20230831210711_ChangeBonusPointColumnTypeToJson")] + partial class ChangeBonusPointColumnTypeToJson + { + 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("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", "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("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.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("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("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("ResultKind") + .IsRequired() + .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("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", "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("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("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.VoteCategoryEntity", "VoteCategory") + .WithMany("AcceptedReviewVotes") + .HasForeignKey("LeagueId", "VoteCategoryId"); + + b.Navigation("MemberAtFault"); + + b.Navigation("Review"); + + 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.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.VoteCategoryEntity", "VoteCategory") + .WithMany("CommentReviewVotes") + .HasForeignKey("LeagueId", "VoteCategoryId"); + + b.Navigation("Comment"); + + b.Navigation("MemberAtFault"); + + 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/20230831210711_ChangeBonusPointColumnTypeToJson.cs b/src/iRLeagueDatabaseCore/Migrations/20230831210711_ChangeBonusPointColumnTypeToJson.cs new file mode 100644 index 0000000..efac5bb --- /dev/null +++ b/src/iRLeagueDatabaseCore/Migrations/20230831210711_ChangeBonusPointColumnTypeToJson.cs @@ -0,0 +1,115 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace iRLeagueDatabaseCore.Migrations +{ + public partial class ChangeBonusPointColumnTypeToJson : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.Sql(@" + -- Create Temporary table holding the bonus points before changing column type + CREATE TEMPORARY TABLE TmpBonusPoints ( + LeagueId BIGINT NOT NULL, + PointRuleId BIGINT NOT NULL PRIMARY KEY, + BonusPoints TEXT + ); + + INSERT INTO TmpBonusPoints (LeagueId, PointRuleId, BonusPoints) + SELECT LeagueId, PointRuleId, BonusPoints + FROM PointRules; + + UPDATE PointRules + SET BonusPoints='[]'; + "); + + migrationBuilder.AlterColumn( + name: "BonusPoints", + table: "PointRules", + type: "json", + nullable: false, + defaultValue: null, + oldClrType: typeof(string), + oldType: "longtext", + oldNullable: true); + + migrationBuilder.Sql(@" + -- Create function to convert bonus values from single string into json array + DROP FUNCTION IF EXISTS splitStringToBonusPoints; + + CREATE FUNCTION splitStringToBonusPoints(inputString TEXT, + pointDelimiter TEXT) + RETURNS TEXT + DETERMINISTIC + BEGIN + DECLARE bonusType TEXT; + DECLARE bonusValue TEXT; + DECLARE bonusPoints TEXT; + SET bonusType = SUBSTRING_INDEX(inputString,pointDelimiter,1); + SET bonusPoints = SUBSTRING(SUBSTRING_INDEX(inputString,pointDelimiter,2), LENGTH(bonusType)+2, 10); + SET bonusValue = IF(LENGTH(bonusType)>1, SUBSTRING(bonusType, 2, 10), '0'); + SET bonusType = SUBSTRING(bonusType, 1, 1); + SET bonusType = CASE bonusType + WHEN 'p' THEN '0' + WHEN 'q' THEN '1' + WHEN 'f' THEN '2' + WHEN 'a' THEN '3' + WHEN 'c' THEN '4' + WHEN 'n' THEN '5' + WHEN 'g' THEN '6' + WHEN 'd' THEN '7' + WHEN 'l' THEN '8' + WHEN 'm' THEN '9' + END; + RETURN CONCAT('{""Type"":',bonusType,',""Value"":',bonusValue,',""Points"":',bonusPoints,',""Conditions"":[]}'); + END; + + DROP FUNCTION IF EXISTS splitToArray; + + CREATE FUNCTION splitToArray( + inputString TEXT, + arrayDelimiter TEXT, + pointDelimiter TEXT) + RETURNS TEXT + DETERMINISTIC + BEGIN + DECLARE tempString TEXT; + SET tempString = '['; + WHILE LOCATE(arrayDelimiter,inputString) > 1 DO + SET tempString = CONCAT(tempString, splitStringToBonusPoints(SUBSTRING_INDEX(inputString,arrayDelimiter,1), pointDelimiter), ','); + SET inputString = REGEXP_REPLACE(inputString, ( + SELECT LEFT(inputString, LOCATE(arrayDelimiter, inputString)) + ),'',1,1); + END WHILE; + SET tempString = CONCAT(tempString, splitStringToBonusPoints(SUBSTRING_INDEX(inputString,arrayDelimiter,1), pointDelimiter), ']'); + RETURN tempString; + END; + + -- Populate `Conditions` column with stored values and perform necessary value conversions + UPDATE TmpBonusPoints + SET BonusPoints = splitToArray(BonusPoints, ';', ':'); + UPDATE PointRules AS pr + JOIN TmpBonusPoints AS tmp + ON tmp.PointRuleId=pr.PointRuleId + SET pr.BonusPoints = tmp.BonusPoints + WHERE tmp.BonusPoints IS NOT NULL; + + DROP TABLE TmpBonusPoints; + DROP FUNCTION splitToArray; + DROP FUNCTION splitStringToBonusPoints; + "); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "BonusPoints", + table: "PointRules", + type: "longtext", + nullable: true, + oldClrType: typeof(string), + oldType: "json"); + } + } +} diff --git a/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs b/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs index c7aa115..922202d 100644 --- a/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs +++ b/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs @@ -1111,7 +1111,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("bigint"); b.Property("BonusPoints") - .HasColumnType("longtext"); + .IsRequired() + .HasColumnType("json"); b.Property("CreatedByUserId") .HasColumnType("longtext"); diff --git a/src/iRLeagueDatabaseCore/Models/PointRuleEntity.cs b/src/iRLeagueDatabaseCore/Models/PointRuleEntity.cs index 3d73c52..dea7d00 100644 --- a/src/iRLeagueDatabaseCore/Models/PointRuleEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/PointRuleEntity.cs @@ -1,4 +1,7 @@ -namespace iRLeagueDatabaseCore.Models; +using iRLeagueApiCore.Common.Models; +using System.Text.Json; + +namespace iRLeagueDatabaseCore.Models; public class PointRuleEntity : IVersionEntity { @@ -13,7 +16,7 @@ public PointRuleEntity() public string Name { get; set; } public ICollection PointsPerPlace { get; set; } - public IDictionary BonusPoints { get; set; } + public ICollection BonusPoints { get; set; } public int MaxPoints { get; set; } public int PointDropOff { get; set; } public ICollection PointsSortOptions { get; set; } @@ -55,7 +58,12 @@ public void Configure(EntityTypeBuilder entity) .HasConversion(new CollectionToStringConverter(), new ValueComparer>(true)); entity.Property(e => e.BonusPoints) - .HasConversion(new DictionaryToStringConverter(), new ValueComparer>(true)); + .HasColumnType("json") + .HasConversion( + v => JsonSerializer.Serialize(v, default(JsonSerializerOptions)), + v => JsonSerializer.Deserialize>(v, default(JsonSerializerOptions)), + new ValueComparer>(false)) + .IsRequired(true); entity.Property(e => e.PointsSortOptions) .HasConversion(new CollectionToStringConverter(), new ValueComparer>(true)); diff --git a/src/iRLeagueDatabaseCore/PopulateTestDatabase.cs b/src/iRLeagueDatabaseCore/PopulateTestDatabase.cs index 5ea951f..7ebeff6 100644 --- a/src/iRLeagueDatabaseCore/PopulateTestDatabase.cs +++ b/src/iRLeagueDatabaseCore/PopulateTestDatabase.cs @@ -206,11 +206,11 @@ public static void Populate(LeagueDbContext context, Random random) { Name = "Points Rule", PointsPerPlace = new List() { 5, 4, 3, 2, 1 }, - BonusPoints = new Dictionary() + BonusPoints = new List() { - { "p1", 3 }, - { "p2", 2 }, - { "p3", 1 }, + new() { Type = BonusPointType.Position, Value = 1, Points = 3 }, + new() { Type = BonusPointType.Position, Value = 2, Points = 2 }, + new() { Type = BonusPointType.Position, Value = 3, Points = 1 }, }, PointsSortOptions = new List() { SortOptions.PosAsc, diff --git a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj index 891d601..40e1892 100644 --- a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj +++ b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj @@ -3,7 +3,7 @@ - + From f53be74886708b165f97fc1df644ba3440c697b7 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Sun, 10 Sep 2023 20:25:12 +0200 Subject: [PATCH 09/12] Fix bonusPoints collection not initialized --- src/iRLeagueDatabaseCore/Models/PointRuleEntity.cs | 1 + src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/iRLeagueDatabaseCore/Models/PointRuleEntity.cs b/src/iRLeagueDatabaseCore/Models/PointRuleEntity.cs index dea7d00..327a8ec 100644 --- a/src/iRLeagueDatabaseCore/Models/PointRuleEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/PointRuleEntity.cs @@ -9,6 +9,7 @@ public PointRuleEntity() { Scorings = new HashSet(); AutoPenalties = new HashSet(); + BonusPoints = new List(); } public long LeagueId { get; set; } diff --git a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj index 5fe363b..ef0a525 100644 --- a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj +++ b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj @@ -24,7 +24,7 @@ Library net6.0 iRLeagueDatabaseCore - 0.9.0-dev.4 + 0.9.0-dev.6 Simon Schulze Simon Schulze This package contains the Entityframework configuration for a Code first project From 00ebd307d13fd43b46abc4482b7badccc7c4f0d8 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Sun, 10 Sep 2023 20:54:14 +0200 Subject: [PATCH 10/12] bump version to 0.9.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 947b7ef..f9b8cb7 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 ef0a525..d2b86e0 100644 --- a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj +++ b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj @@ -3,7 +3,7 @@ - + @@ -24,7 +24,7 @@ Library net6.0 iRLeagueDatabaseCore - 0.9.0-dev.6 + 0.9.0 Simon Schulze Simon Schulze This package contains the Entityframework configuration for a Code first project From 0da485cb6a93c45a96f1e6100adc99e60e841315 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Sun, 10 Sep 2023 21:19:37 +0200 Subject: [PATCH 11/12] Use champseason to define ResultKind instead of ResultConfiguration --- ...rationMoveResultKindToChampSeasonTable.sql | 38 + ...veResultKindToChampSeasonTable.Designer.cs | 3870 +++++++++++++++++ ...190957_MoveResultKindToChampSeasonTable.cs | 63 + .../LeagueDbContextModelSnapshot.cs | 9 +- .../Models/ChampSeasonEntity.cs | 5 + .../Models/ResultConfigurationEntity.cs | 3 - 6 files changed, 3981 insertions(+), 7 deletions(-) create mode 100644 src/iRLeagueDatabaseCore/MigrationMoveResultKindToChampSeasonTable.sql create mode 100644 src/iRLeagueDatabaseCore/Migrations/20230910190957_MoveResultKindToChampSeasonTable.Designer.cs create mode 100644 src/iRLeagueDatabaseCore/Migrations/20230910190957_MoveResultKindToChampSeasonTable.cs diff --git a/src/iRLeagueDatabaseCore/MigrationMoveResultKindToChampSeasonTable.sql b/src/iRLeagueDatabaseCore/MigrationMoveResultKindToChampSeasonTable.sql new file mode 100644 index 0000000..01a5c4c --- /dev/null +++ b/src/iRLeagueDatabaseCore/MigrationMoveResultKindToChampSeasonTable.sql @@ -0,0 +1,38 @@ +/* Migrate the filterOptionEntity used on ResultConfigs to use json column for Conditions + * instead of previous FilterConditionEntity + */ + +USE TestDatabase; + +START TRANSACTION; + +DROP TABLE IF EXISTS TmpResultConfigKinds; + +CREATE TEMPORARY TABLE TmpResultConfigKinds( + LeagueId BIGINT NOT NULL, + ResultConfigId BIGINT NOT NULL, + ChampSeasonId BIGINT NOT NULL, + ResultKind VARCHAR(50) NOT NULL, + PRIMARY KEY(LeagueId, ResultConfigId) +); + +INSERT INTO TmpResultConfigKinds(LeagueId, ResultConfigId, ChampSeasonId, ResultKind) + SELECT LeagueId, ResultConfigId, ChampSeasonId, ResultKind FROM ResultConfigurations; + +SELECT * FROM TmpResultConfigKinds; + +-- Populate `Conditions` column with stored values and perform necessary value conversions +UPDATE ChampSeasons AS cs + JOIN TmpResultConfigKinds as rc + ON cs.ChampSeasonId=rc.ChampSeasonId + SET cs.ResultKind=rc.ResultKind; + +UPDATE ChampSeasons + SET ResultKind='Member' + WHERE ResultKind=''; + +SELECT LeagueId, ChampSeasonId, ResultKind FROM ChampSeasons; + +DROP TABLE TmpResultConfigKinds; + +ROLLBACK; \ No newline at end of file diff --git a/src/iRLeagueDatabaseCore/Migrations/20230910190957_MoveResultKindToChampSeasonTable.Designer.cs b/src/iRLeagueDatabaseCore/Migrations/20230910190957_MoveResultKindToChampSeasonTable.Designer.cs new file mode 100644 index 0000000..bde61ad --- /dev/null +++ b/src/iRLeagueDatabaseCore/Migrations/20230910190957_MoveResultKindToChampSeasonTable.Designer.cs @@ -0,0 +1,3870 @@ +// +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("20230910190957_MoveResultKindToChampSeasonTable")] + partial class MoveResultKindToChampSeasonTable + { + 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("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", "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.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("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("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("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", "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("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.VoteCategoryEntity", "VoteCategory") + .WithMany("AcceptedReviewVotes") + .HasForeignKey("LeagueId", "VoteCategoryId"); + + b.Navigation("MemberAtFault"); + + b.Navigation("Review"); + + 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.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.VoteCategoryEntity", "VoteCategory") + .WithMany("CommentReviewVotes") + .HasForeignKey("LeagueId", "VoteCategoryId"); + + b.Navigation("Comment"); + + b.Navigation("MemberAtFault"); + + 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/20230910190957_MoveResultKindToChampSeasonTable.cs b/src/iRLeagueDatabaseCore/Migrations/20230910190957_MoveResultKindToChampSeasonTable.cs new file mode 100644 index 0000000..9d92385 --- /dev/null +++ b/src/iRLeagueDatabaseCore/Migrations/20230910190957_MoveResultKindToChampSeasonTable.cs @@ -0,0 +1,63 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace iRLeagueDatabaseCore.Migrations +{ + public partial class MoveResultKindToChampSeasonTable : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.Sql(@" + CREATE TEMPORARY TABLE TmpResultConfigKinds( + LeagueId BIGINT NOT NULL, + ResultConfigId BIGINT NOT NULL, + ChampSeasonId BIGINT NOT NULL, + ResultKind VARCHAR(50) NOT NULL, + PRIMARY KEY(LeagueId, ResultConfigId) + ); + + INSERT INTO TmpResultConfigKinds(LeagueId, ResultConfigId, ChampSeasonId, ResultKind) + SELECT LeagueId, ResultConfigId, ChampSeasonId, ResultKind FROM ResultConfigurations; + "); + + migrationBuilder.DropColumn( + name: "ResultKind", + table: "ResultConfigurations"); + + migrationBuilder.AddColumn( + name: "ResultKind", + table: "ChampSeasons", + type: "varchar(50)", + maxLength: 50, + nullable: false, + defaultValue: ""); + + migrationBuilder.Sql(@" + UPDATE ChampSeasons AS cs + JOIN TmpResultConfigKinds as rc + ON cs.ChampSeasonId=rc.ChampSeasonId + SET cs.ResultKind=rc.ResultKind; + + UPDATE ChampSeasons + SET ResultKind='Member' + WHERE ResultKind=''; + + DROP TABLE TmpResultConfigKinds; + "); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ResultKind", + table: "ChampSeasons"); + + migrationBuilder.AddColumn( + name: "ResultKind", + table: "ResultConfigurations", + type: "longtext", + nullable: false); + } + } +} diff --git a/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs b/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs index bb90d1e..20c87d8 100644 --- a/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs +++ b/src/iRLeagueDatabaseCore/Migrations/LeagueDbContextModelSnapshot.cs @@ -239,6 +239,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("LastModifiedOn") .HasColumnType("datetime(6)"); + b.Property("ResultKind") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + b.Property("SeasonId") .HasColumnType("bigint"); @@ -1251,10 +1256,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Name") .HasColumnType("longtext"); - b.Property("ResultKind") - .IsRequired() - .HasColumnType("longtext"); - b.Property("ResultsPerTeam") .HasColumnType("int"); diff --git a/src/iRLeagueDatabaseCore/Models/ChampSeasonEntity.cs b/src/iRLeagueDatabaseCore/Models/ChampSeasonEntity.cs index dd12532..174859c 100644 --- a/src/iRLeagueDatabaseCore/Models/ChampSeasonEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/ChampSeasonEntity.cs @@ -17,6 +17,7 @@ public ChampSeasonEntity() public long SeasonId { get; set; } public long? DefaultResultConfigId { get; set; } public long? StandingConfigId { get; set; } + public ResultKind ResultKind { get; set; } public bool IsActive { get; set; } public virtual ChampionshipEntity Championship { get; set; } @@ -52,6 +53,10 @@ public void Configure(EntityTypeBuilder entity) entity.Property(e => e.ChampSeasonId) .ValueGeneratedOnAdd(); + entity.Property(e => e.ResultKind) + .HasConversion>() + .HasMaxLength(50); + entity.HasOne(d => d.Championship) .WithMany(p => p.ChampSeasons) .HasForeignKey(d => new { d.LeagueId, d.ChampionshipId }) diff --git a/src/iRLeagueDatabaseCore/Models/ResultConfigurationEntity.cs b/src/iRLeagueDatabaseCore/Models/ResultConfigurationEntity.cs index 36d516a..da3075e 100644 --- a/src/iRLeagueDatabaseCore/Models/ResultConfigurationEntity.cs +++ b/src/iRLeagueDatabaseCore/Models/ResultConfigurationEntity.cs @@ -17,7 +17,6 @@ public ResultConfigurationEntity() public string Name { get; set; } public string DisplayName { get; set; } - public ResultKind ResultKind { get; set; } public int ResultsPerTeam { get; set; } public virtual LeagueEntity League { get; set; } @@ -50,8 +49,6 @@ public void Configure(EntityTypeBuilder entity) entity.Property(e => e.ResultConfigId) .ValueGeneratedOnAdd(); - entity.Property(e => e.ResultKind).HasConversion>(); - entity.Property(e => e.CreatedOn).HasColumnType("datetime"); entity.Property(e => e.LastModifiedOn).HasColumnType("datetime"); From 51636dfa98ced349308d2cb5f9172d6d4ccec6b8 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Sun, 10 Sep 2023 21:52:01 +0200 Subject: [PATCH 12/12] update packages --- src/DatabaseBenchmarks/DatabaseBenchmarks.csproj | 2 +- src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DatabaseBenchmarks/DatabaseBenchmarks.csproj b/src/DatabaseBenchmarks/DatabaseBenchmarks.csproj index f9b8cb7..be7edf5 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 d2b86e0..8aee3b3 100644 --- a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj +++ b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj @@ -3,7 +3,7 @@ - +