LANCommander/LANCommander.Server.Data.MySQL/Migrations/DatabaseContextModelSnapshot.cs

2581 lines
89 KiB
C#
Raw Normal View History

// <auto-generated />
using System;
using LANCommander.Server.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace LANCommander.Server.Data.MySQL.Migrations
{
[DbContext(typeof(DatabaseContext))]
partial class DatabaseContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
WIP fix for MySQL connection concurrency issues This is a large commit. There are a number of things that this commit does to try to fix various issues that were occurring when the database provider was set to MySQL: - The DAL `Repository` has been completely refactored to follow best practices. The repository is now being injected into services instead of the database context itself. This allows the DI to handle the repository's lifetime instead of creating a new repository for every transaction and sharing the context across repositories. As part of these changes, there is no more allowed usage of `IQueryable` and all service/repository methods must actually execute database queries before their return. This is to ensure that the context does not stay open longer than it needs to. Abusing `IQueryable`s by tossing them into Blazor components seems to be a big no-no. - Some deletion behaviors on relationships have been tweaked as MySQL wasn't able to apply migrations with behaviors that were contradictory. - A `ConnectionInterceptor` was added to try to keep track of `DatabaseContext` lifetimes. This is really only for debugging and should be put into `#if DEBUG` regions. This helped identify some potential issues where some contexts were basically never closing, causing the MySQL connector to not function. - Docs for generating migrations have been updated to reflect the addition of being able to specify the database provider and connection string when adding a migration, avoiding the need to edit `Settings.yml` - The application can now be put into a pause state on startup by adding the `--debugger` argument when used from the command line. When a debugger is attached, it resumes execution. - The application can now log to Seq when using debug build - Service lifetime on `DatabaseContext` has switched to transient. This may be reverted in the future. - Lazy loading has been disabled for debugging purposes. It didn't directly help the concurrency issues, but it needs to be tested individually to be re-enabled. - All usage of `UserManager`, `RoleManager`, and `SignInManager` have been removed from all controllers, pages, and Blazor components. Functionality has been moved to `UserService` and `RoleService`. This might have done the most amount of help, but could probably be improved upon in the future by not relying on them and instead having our own implementation. - Application startup migrations and server autostarts have been disabled temporarily. There might be an issue of `DatabaseContext` lifetimes that spawn from this.
2024-10-13 20:42:45 -05:00
.HasAnnotation("ProductVersion", "8.0.10")
.HasAnnotation("Proxies:ChangeTracking", false)
.HasAnnotation("Proxies:CheckEquality", false)
.HasAnnotation("Proxies:LazyLoading", true)
.HasAnnotation("Relational:MaxIdentifierLength", 64);
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
modelBuilder.Entity("CategoryGame", b =>
{
b.Property<Guid>("CategoriesId")
.HasColumnType("char(36)");
b.Property<Guid>("GamesId")
.HasColumnType("char(36)");
b.HasKey("CategoriesId", "GamesId");
b.HasIndex("GamesId");
b.ToTable("CategoryGame");
});
modelBuilder.Entity("CollectionGame", b =>
{
b.Property<Guid>("CollectionId")
.HasColumnType("char(36)");
b.Property<Guid>("GameId")
.HasColumnType("char(36)");
b.HasKey("CollectionId", "GameId");
b.HasIndex("GameId");
b.ToTable("CollectionGame");
});
modelBuilder.Entity("GameDeveloper", b =>
{
b.Property<Guid>("DeveloperId")
.HasColumnType("char(36)");
b.Property<Guid>("GameId")
.HasColumnType("char(36)");
b.HasKey("DeveloperId", "GameId");
b.HasIndex("GameId");
b.ToTable("GameDeveloper");
});
modelBuilder.Entity("GameGenre", b =>
{
b.Property<Guid>("GamesId")
.HasColumnType("char(36)");
b.Property<Guid>("GenresId")
.HasColumnType("char(36)");
b.HasKey("GamesId", "GenresId");
b.HasIndex("GenresId");
b.ToTable("GameGenre");
});
modelBuilder.Entity("GamePlatform", b =>
{
b.Property<Guid>("GamesId")
.HasColumnType("char(36)");
b.Property<Guid>("PlatformsId")
.HasColumnType("char(36)");
b.HasKey("GamesId", "PlatformsId");
b.HasIndex("PlatformsId");
b.ToTable("GamePlatform");
});
modelBuilder.Entity("GamePublisher", b =>
{
b.Property<Guid>("GameId")
.HasColumnType("char(36)");
b.Property<Guid>("PublisherId")
.HasColumnType("char(36)");
b.HasKey("GameId", "PublisherId");
b.HasIndex("PublisherId");
b.ToTable("GamePublisher");
});
modelBuilder.Entity("GameRedistributable", b =>
{
b.Property<Guid>("GameId")
.HasColumnType("char(36)");
b.Property<Guid>("RedistributableId")
.HasColumnType("char(36)");
b.HasKey("GameId", "RedistributableId");
b.HasIndex("RedistributableId");
b.ToTable("GameRedistributable");
});
modelBuilder.Entity("GameTag", b =>
{
b.Property<Guid>("GamesId")
.HasColumnType("char(36)");
b.Property<Guid>("TagsId")
.HasColumnType("char(36)");
b.HasKey("GamesId", "TagsId");
b.HasIndex("TagsId");
b.ToTable("GameTag");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Action", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Arguments")
.HasColumnType("longtext");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<Guid?>("GameId")
.HasColumnType("char(36)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Path")
.HasColumnType("longtext");
b.Property<bool>("PrimaryAction")
.HasColumnType("tinyint(1)");
b.Property<Guid?>("ServerId")
.HasColumnType("char(36)");
b.Property<int>("SortOrder")
.HasColumnType("int");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("WorkingDirectory")
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("GameId");
b.HasIndex("ServerId");
b.HasIndex("UpdatedById");
b.ToTable("Actions");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Archive", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Changelog")
.HasColumnType("longtext");
b.Property<long>("CompressedSize")
.HasColumnType("bigint");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<Guid?>("GameId")
.HasColumnType("char(36)");
b.Property<Guid?>("LastVersionId")
.HasColumnType("char(36)");
b.Property<string>("ObjectKey")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid?>("RedistributableId")
.HasColumnType("char(36)");
b.Property<Guid>("StorageLocationId")
.HasColumnType("char(36)");
b.Property<long>("UncompressedSize")
.HasColumnType("bigint");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("Version")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("GameId");
b.HasIndex("LastVersionId");
b.HasIndex("RedistributableId");
b.HasIndex("StorageLocationId");
b.HasIndex("UpdatedById");
b.ToTable("Archive");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Category", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid>("ParentId")
.HasColumnType("char(36)");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("ParentId");
b.HasIndex("UpdatedById");
b.ToTable("Categories");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Collection", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("UpdatedById");
b.ToTable("Collections");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Company", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("UpdatedById");
b.ToTable("Companies");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Engine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("UpdatedById");
b.ToTable("Engines");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Game", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("BaseGameId")
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<string>("DirectoryName")
.HasColumnType("longtext");
b.Property<Guid?>("EngineId")
.HasColumnType("char(36)");
b.Property<long?>("IGDBId")
.HasColumnType("bigint");
b.Property<int>("KeyAllocationMethod")
.HasColumnType("int");
b.Property<string>("Notes")
.HasColumnType("longtext");
b.Property<DateTime?>("ReleasedOn")
.HasColumnType("datetime(6)");
b.Property<bool>("Singleplayer")
.HasColumnType("tinyint(1)");
b.Property<string>("SortTitle")
.HasColumnType("longtext");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("Type")
.HasColumnType("int");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("ValidKeyRegex")
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("BaseGameId");
b.HasIndex("CreatedById");
b.HasIndex("EngineId");
b.HasIndex("UpdatedById");
b.ToTable("Games");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.GameSave", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<Guid?>("GameId")
.HasColumnType("char(36)");
b.Property<Guid>("StorageLocationId")
.HasColumnType("char(36)");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("GameId");
b.HasIndex("StorageLocationId");
b.HasIndex("UpdatedById");
b.HasIndex("UserId");
b.ToTable("GameSaves");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Genre", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("UpdatedById");
b.ToTable("Genres");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Issue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid>("GameId")
.HasColumnType("char(36)");
b.Property<Guid?>("ResolvedById")
.HasColumnType("char(36)");
b.Property<DateTime?>("ResolvedOn")
.HasColumnType("datetime(6)");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("GameId");
b.HasIndex("ResolvedById");
b.HasIndex("UpdatedById");
b.ToTable("Issues");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Key", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<int>("AllocationMethod")
.HasColumnType("int");
b.Property<string>("ClaimedByComputerName")
.HasMaxLength(255)
.HasColumnType("varchar(255)");
b.Property<string>("ClaimedByIpv4Address")
.HasMaxLength(15)
.HasColumnType("varchar(15)");
b.Property<string>("ClaimedByMacAddress")
.HasMaxLength(17)
.HasColumnType("varchar(17)");
b.Property<Guid?>("ClaimedByUserId")
.HasColumnType("char(36)");
b.Property<DateTime?>("ClaimedOn")
.HasColumnType("datetime(6)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<Guid>("GameId")
.HasColumnType("char(36)");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("varchar(255)");
b.HasKey("Id");
b.HasIndex("ClaimedByUserId");
b.HasIndex("CreatedById");
b.HasIndex("GameId");
b.HasIndex("UpdatedById");
b.ToTable("Keys");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Media", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Crc32")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("varchar(8)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<Guid>("FileId")
.HasColumnType("char(36)");
b.Property<Guid?>("GameId")
.HasColumnType("char(36)");
b.Property<string>("MimeType")
.HasMaxLength(255)
.HasColumnType("varchar(255)");
b.Property<string>("Name")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("SourceUrl")
.HasMaxLength(2048)
.HasColumnType("varchar(2048)");
b.Property<Guid>("StorageLocationId")
.HasColumnType("char(36)");
b.Property<Guid?>("ThumbnailId")
.HasColumnType("char(36)");
b.Property<int>("Type")
.HasColumnType("int");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.Property<Guid?>("UserId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("GameId");
b.HasIndex("StorageLocationId");
b.HasIndex("ThumbnailId")
.IsUnique();
b.HasIndex("UpdatedById");
b.HasIndex("UserId");
b.ToTable("Media");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.MultiplayerMode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<Guid?>("GameId")
.IsRequired()
.HasColumnType("char(36)");
b.Property<int>("MaxPlayers")
.HasColumnType("int");
b.Property<int>("MinPlayers")
.HasColumnType("int");
b.Property<int>("NetworkProtocol")
.HasColumnType("int");
b.Property<int>("Spectators")
.HasColumnType("int");
b.Property<int>("Type")
.HasColumnType("int");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("GameId");
b.HasIndex("UpdatedById");
b.ToTable("MultiplayerModes");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Page", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Contents")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<Guid?>("ParentId")
.HasColumnType("char(36)");
b.Property<string>("Route")
.IsRequired()
.HasMaxLength(2048)
.HasColumnType("varchar(2048)");
b.Property<string>("Slug")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<int>("SortOrder")
.HasColumnType("int");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("ParentId");
b.HasIndex("UpdatedById");
b.ToTable("Pages");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Platform", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("UpdatedById");
b.ToTable("Platforms");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.PlaySession", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<DateTime?>("End")
.HasColumnType("datetime(6)");
b.Property<Guid?>("GameId")
.HasColumnType("char(36)");
b.Property<DateTime?>("Start")
.HasColumnType("datetime(6)");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("GameId");
b.HasIndex("UpdatedById");
b.HasIndex("UserId");
b.ToTable("PlaySessions");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Redistributable", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Notes")
.HasColumnType("longtext");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("UpdatedById");
b.ToTable("Redistributables");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Role", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("LANCommander.Server.Data.Models.SavePath", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<Guid?>("GameId")
.HasColumnType("char(36)");
b.Property<bool>("IsRegex")
.HasColumnType("tinyint(1)");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("Type")
.HasColumnType("int");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("WorkingDirectory")
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("GameId");
b.HasIndex("UpdatedById");
b.ToTable("SavePaths");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Script", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Contents")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<Guid?>("GameId")
.HasColumnType("char(36)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid?>("RedistributableId")
.HasColumnType("char(36)");
b.Property<bool>("RequiresAdmin")
.HasColumnType("tinyint(1)");
b.Property<Guid?>("ServerId")
.HasColumnType("char(36)");
b.Property<int>("Type")
.HasColumnType("int");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("GameId");
b.HasIndex("RedistributableId");
b.HasIndex("ServerId");
b.HasIndex("UpdatedById");
b.ToTable("Scripts");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Server", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Arguments")
.IsRequired()
.HasColumnType("longtext");
b.Property<bool>("Autostart")
.HasColumnType("tinyint(1)");
b.Property<int>("AutostartDelay")
.HasColumnType("int");
b.Property<int>("AutostartMethod")
.HasColumnType("int");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<Guid?>("GameId")
.HasColumnType("char(36)");
b.Property<string>("Host")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OnStartScriptPath")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OnStopScriptPath")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("Port")
.HasColumnType("int");
b.Property<int>("ProcessTerminationMethod")
.HasColumnType("int");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.Property<bool>("UseShellExecute")
.HasColumnType("tinyint(1)");
b.Property<string>("WorkingDirectory")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("GameId");
b.HasIndex("UpdatedById");
b.ToTable("Servers");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.ServerConsole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("Host")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("longtext");
b.Property<int?>("Port")
.HasColumnType("int");
b.Property<Guid?>("ServerId")
.IsRequired()
.HasColumnType("char(36)");
b.Property<Guid?>("ServerId1")
.HasColumnType("char(36)");
b.Property<int>("Type")
.HasColumnType("int");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("ServerId");
b.HasIndex("ServerId1");
b.HasIndex("UpdatedById");
b.ToTable("ServerConsoles");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.ServerHttpPath", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("LocalPath")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid>("ServerId")
.HasColumnType("char(36)");
b.Property<Guid?>("ServerId1")
.HasColumnType("char(36)");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("ServerId");
b.HasIndex("ServerId1");
b.HasIndex("UpdatedById");
b.ToTable("ServerHttpPath");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.StorageLocation", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<bool>("Default")
.HasColumnType("tinyint(1)");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("Type")
.HasColumnType("int");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("UpdatedById");
b.ToTable("StorageLocations");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Tag", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("UpdatedById");
b.ToTable("Tags");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("Alias")
.HasColumnType("longtext");
b.Property<bool>("Approved")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("ApprovedOn")
.HasColumnType("datetime(6)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("tinyint(1)");
b.Property<bool>("LockoutEnabled")
.HasColumnType("tinyint(1)");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetime(6)");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("longtext");
b.Property<string>("PhoneNumber")
.HasColumnType("longtext");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("RefreshToken")
.HasColumnType("longtext");
b.Property<DateTime>("RefreshTokenExpiration")
.HasColumnType("datetime(6)");
b.Property<string>("SecurityStamp")
.HasColumnType("longtext");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("tinyint(1)");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("LANCommander.Server.Data.Models.UserCustomField", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid?>("CreatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime(6)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("datetime(6)");
b.Property<Guid?>("UserId")
.IsRequired()
.HasColumnType("char(36)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("varchar(1024)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("UpdatedById");
b.HasIndex("UserId");
b.ToTable("UserCustomField");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<Guid>("RoleId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderKey")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("longtext");
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.Property<Guid>("RoleId")
.HasColumnType("char(36)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Name")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Value")
.HasColumnType("longtext");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("PageGame", b =>
{
b.Property<Guid>("GameId")
.HasColumnType("char(36)");
b.Property<Guid>("PageId")
.HasColumnType("char(36)");
b.HasKey("GameId", "PageId");
b.HasIndex("PageId");
b.ToTable("PageGame");
});
modelBuilder.Entity("PageRedistributable", b =>
{
b.Property<Guid>("PageId")
.HasColumnType("char(36)");
b.Property<Guid>("RedistributableId")
.HasColumnType("char(36)");
b.HasKey("PageId", "RedistributableId");
b.HasIndex("RedistributableId");
b.ToTable("PageRedistributable");
});
modelBuilder.Entity("PageServer", b =>
{
b.Property<Guid>("PageId")
.HasColumnType("char(36)");
b.Property<Guid>("ServerId")
.HasColumnType("char(36)");
b.HasKey("PageId", "ServerId");
b.HasIndex("ServerId");
b.ToTable("PageServer");
});
modelBuilder.Entity("RoleCollection", b =>
{
b.Property<Guid>("CollectionId")
.HasColumnType("char(36)");
b.Property<Guid>("RoleId")
.HasColumnType("char(36)");
b.HasKey("CollectionId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("RoleCollection");
});
modelBuilder.Entity("CategoryGame", b =>
{
b.HasOne("LANCommander.Server.Data.Models.Category", null)
.WithMany()
.HasForeignKey("CategoriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.Game", null)
.WithMany()
.HasForeignKey("GamesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CollectionGame", b =>
{
b.HasOne("LANCommander.Server.Data.Models.Collection", null)
.WithMany()
.HasForeignKey("CollectionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.Game", null)
.WithMany()
.HasForeignKey("GameId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("GameDeveloper", b =>
{
b.HasOne("LANCommander.Server.Data.Models.Company", null)
.WithMany()
.HasForeignKey("DeveloperId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.Game", null)
.WithMany()
.HasForeignKey("GameId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("GameGenre", b =>
{
b.HasOne("LANCommander.Server.Data.Models.Game", null)
.WithMany()
.HasForeignKey("GamesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.Genre", null)
.WithMany()
.HasForeignKey("GenresId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("GamePlatform", b =>
{
b.HasOne("LANCommander.Server.Data.Models.Game", null)
.WithMany()
.HasForeignKey("GamesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.Platform", null)
.WithMany()
.HasForeignKey("PlatformsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("GamePublisher", b =>
{
b.HasOne("LANCommander.Server.Data.Models.Game", null)
.WithMany()
.HasForeignKey("GameId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.Company", null)
.WithMany()
.HasForeignKey("PublisherId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("GameRedistributable", b =>
{
b.HasOne("LANCommander.Server.Data.Models.Game", null)
.WithMany()
.HasForeignKey("GameId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.Redistributable", null)
.WithMany()
.HasForeignKey("RedistributableId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("GameTag", b =>
{
b.HasOne("LANCommander.Server.Data.Models.Game", null)
.WithMany()
.HasForeignKey("GamesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.Tag", null)
.WithMany()
.HasForeignKey("TagsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Action", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.Game", "Game")
.WithMany("Actions")
.HasForeignKey("GameId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("LANCommander.Server.Data.Models.Server", "Server")
.WithMany("Actions")
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("CreatedBy");
b.Navigation("Game");
b.Navigation("Server");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Archive", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.Game", "Game")
.WithMany("Archives")
.HasForeignKey("GameId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("LANCommander.Server.Data.Models.Archive", "LastVersion")
.WithMany()
.HasForeignKey("LastVersionId");
b.HasOne("LANCommander.Server.Data.Models.Redistributable", "Redistributable")
.WithMany("Archives")
.HasForeignKey("RedistributableId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("LANCommander.Server.Data.Models.StorageLocation", "StorageLocation")
.WithMany("Archives")
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("CreatedBy");
b.Navigation("Game");
b.Navigation("LastVersion");
b.Navigation("Redistributable");
b.Navigation("StorageLocation");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Category", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.Category", "Parent")
.WithMany("Children")
.HasForeignKey("ParentId");
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("CreatedBy");
b.Navigation("Parent");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Collection", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("CreatedBy");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Company", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("CreatedBy");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Engine", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById");
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById");
b.Navigation("CreatedBy");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Game", b =>
{
b.HasOne("LANCommander.Server.Data.Models.Game", "BaseGame")
.WithMany("DependentGames")
.HasForeignKey("BaseGameId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.Engine", "Engine")
.WithMany("Games")
.HasForeignKey("EngineId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("BaseGame");
b.Navigation("CreatedBy");
b.Navigation("Engine");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.GameSave", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.Game", "Game")
.WithMany("GameSaves")
.HasForeignKey("GameId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.StorageLocation", "StorageLocation")
.WithMany("GameSaves")
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.User", "User")
.WithMany("GameSaves")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CreatedBy");
b.Navigation("Game");
b.Navigation("StorageLocation");
b.Navigation("UpdatedBy");
b.Navigation("User");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Genre", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("CreatedBy");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Issue", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.Game", "Game")
.WithMany("Issues")
.HasForeignKey("GameId")
WIP fix for MySQL connection concurrency issues This is a large commit. There are a number of things that this commit does to try to fix various issues that were occurring when the database provider was set to MySQL: - The DAL `Repository` has been completely refactored to follow best practices. The repository is now being injected into services instead of the database context itself. This allows the DI to handle the repository's lifetime instead of creating a new repository for every transaction and sharing the context across repositories. As part of these changes, there is no more allowed usage of `IQueryable` and all service/repository methods must actually execute database queries before their return. This is to ensure that the context does not stay open longer than it needs to. Abusing `IQueryable`s by tossing them into Blazor components seems to be a big no-no. - Some deletion behaviors on relationships have been tweaked as MySQL wasn't able to apply migrations with behaviors that were contradictory. - A `ConnectionInterceptor` was added to try to keep track of `DatabaseContext` lifetimes. This is really only for debugging and should be put into `#if DEBUG` regions. This helped identify some potential issues where some contexts were basically never closing, causing the MySQL connector to not function. - Docs for generating migrations have been updated to reflect the addition of being able to specify the database provider and connection string when adding a migration, avoiding the need to edit `Settings.yml` - The application can now be put into a pause state on startup by adding the `--debugger` argument when used from the command line. When a debugger is attached, it resumes execution. - The application can now log to Seq when using debug build - Service lifetime on `DatabaseContext` has switched to transient. This may be reverted in the future. - Lazy loading has been disabled for debugging purposes. It didn't directly help the concurrency issues, but it needs to be tested individually to be re-enabled. - All usage of `UserManager`, `RoleManager`, and `SignInManager` have been removed from all controllers, pages, and Blazor components. Functionality has been moved to `UserService` and `RoleService`. This might have done the most amount of help, but could probably be improved upon in the future by not relying on them and instead having our own implementation. - Application startup migrations and server autostarts have been disabled temporarily. There might be an issue of `DatabaseContext` lifetimes that spawn from this.
2024-10-13 20:42:45 -05:00
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.User", "ResolvedBy")
.WithMany()
.HasForeignKey("ResolvedById");
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("CreatedBy");
b.Navigation("Game");
b.Navigation("ResolvedBy");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Key", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "ClaimedByUser")
.WithMany()
.HasForeignKey("ClaimedByUserId");
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.Game", "Game")
.WithMany("Keys")
.HasForeignKey("GameId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("ClaimedByUser");
b.Navigation("CreatedBy");
b.Navigation("Game");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Media", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.Game", "Game")
.WithMany("Media")
.HasForeignKey("GameId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("LANCommander.Server.Data.Models.StorageLocation", "StorageLocation")
.WithMany("Media")
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.Media", "Thumbnail")
.WithOne("Parent")
.HasForeignKey("LANCommander.Server.Data.Models.Media", "ThumbnailId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.User", "User")
.WithMany("Media")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("CreatedBy");
b.Navigation("Game");
b.Navigation("StorageLocation");
b.Navigation("Thumbnail");
b.Navigation("UpdatedBy");
b.Navigation("User");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.MultiplayerMode", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.Game", "Game")
.WithMany("MultiplayerModes")
.HasForeignKey("GameId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("CreatedBy");
b.Navigation("Game");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Page", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.Page", "Parent")
.WithMany("Children")
.HasForeignKey("ParentId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("CreatedBy");
b.Navigation("Parent");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Platform", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("CreatedBy");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.PlaySession", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.Game", "Game")
.WithMany("PlaySessions")
.HasForeignKey("GameId")
WIP fix for MySQL connection concurrency issues This is a large commit. There are a number of things that this commit does to try to fix various issues that were occurring when the database provider was set to MySQL: - The DAL `Repository` has been completely refactored to follow best practices. The repository is now being injected into services instead of the database context itself. This allows the DI to handle the repository's lifetime instead of creating a new repository for every transaction and sharing the context across repositories. As part of these changes, there is no more allowed usage of `IQueryable` and all service/repository methods must actually execute database queries before their return. This is to ensure that the context does not stay open longer than it needs to. Abusing `IQueryable`s by tossing them into Blazor components seems to be a big no-no. - Some deletion behaviors on relationships have been tweaked as MySQL wasn't able to apply migrations with behaviors that were contradictory. - A `ConnectionInterceptor` was added to try to keep track of `DatabaseContext` lifetimes. This is really only for debugging and should be put into `#if DEBUG` regions. This helped identify some potential issues where some contexts were basically never closing, causing the MySQL connector to not function. - Docs for generating migrations have been updated to reflect the addition of being able to specify the database provider and connection string when adding a migration, avoiding the need to edit `Settings.yml` - The application can now be put into a pause state on startup by adding the `--debugger` argument when used from the command line. When a debugger is attached, it resumes execution. - The application can now log to Seq when using debug build - Service lifetime on `DatabaseContext` has switched to transient. This may be reverted in the future. - Lazy loading has been disabled for debugging purposes. It didn't directly help the concurrency issues, but it needs to be tested individually to be re-enabled. - All usage of `UserManager`, `RoleManager`, and `SignInManager` have been removed from all controllers, pages, and Blazor components. Functionality has been moved to `UserService` and `RoleService`. This might have done the most amount of help, but could probably be improved upon in the future by not relying on them and instead having our own implementation. - Application startup migrations and server autostarts have been disabled temporarily. There might be an issue of `DatabaseContext` lifetimes that spawn from this.
2024-10-13 20:42:45 -05:00
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.User", "User")
.WithMany("PlaySessions")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CreatedBy");
b.Navigation("Game");
b.Navigation("UpdatedBy");
b.Navigation("User");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Redistributable", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("CreatedBy");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.SavePath", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.Game", "Game")
.WithMany("SavePaths")
.HasForeignKey("GameId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("CreatedBy");
b.Navigation("Game");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Script", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.Game", "Game")
.WithMany("Scripts")
.HasForeignKey("GameId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("LANCommander.Server.Data.Models.Redistributable", "Redistributable")
.WithMany("Scripts")
.HasForeignKey("RedistributableId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("LANCommander.Server.Data.Models.Server", "Server")
.WithMany("Scripts")
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("CreatedBy");
b.Navigation("Game");
b.Navigation("Redistributable");
b.Navigation("Server");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Server", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.Game", "Game")
.WithMany("Servers")
.HasForeignKey("GameId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("CreatedBy");
b.Navigation("Game");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.ServerConsole", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.Server", "Server")
.WithMany()
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.Server", null)
.WithMany("ServerConsoles")
.HasForeignKey("ServerId1");
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("CreatedBy");
b.Navigation("Server");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.ServerHttpPath", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.Server", "Server")
.WithMany()
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.Server", null)
.WithMany("HttpPaths")
.HasForeignKey("ServerId1");
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("CreatedBy");
b.Navigation("Server");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.StorageLocation", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById");
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById");
b.Navigation("CreatedBy");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Tag", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("CreatedBy");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.UserCustomField", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById");
b.HasOne("LANCommander.Server.Data.Models.User", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById");
b.HasOne("LANCommander.Server.Data.Models.User", "User")
.WithMany("CustomFields")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CreatedBy");
b.Navigation("UpdatedBy");
b.Navigation("User");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
{
b.HasOne("LANCommander.Server.Data.Models.Role", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
{
b.HasOne("LANCommander.Server.Data.Models.Role", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
{
b.HasOne("LANCommander.Server.Data.Models.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PageGame", b =>
{
b.HasOne("LANCommander.Server.Data.Models.Game", null)
.WithMany()
.HasForeignKey("GameId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.Page", null)
.WithMany()
.HasForeignKey("PageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PageRedistributable", b =>
{
b.HasOne("LANCommander.Server.Data.Models.Page", null)
.WithMany()
.HasForeignKey("PageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.Redistributable", null)
.WithMany()
.HasForeignKey("RedistributableId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PageServer", b =>
{
b.HasOne("LANCommander.Server.Data.Models.Page", null)
.WithMany()
.HasForeignKey("PageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.Server", null)
.WithMany()
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("RoleCollection", b =>
{
b.HasOne("LANCommander.Server.Data.Models.Collection", null)
.WithMany()
.HasForeignKey("CollectionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LANCommander.Server.Data.Models.Role", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Category", b =>
{
b.Navigation("Children");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Engine", b =>
{
b.Navigation("Games");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Game", b =>
{
b.Navigation("Actions");
b.Navigation("Archives");
b.Navigation("DependentGames");
b.Navigation("GameSaves");
b.Navigation("Issues");
b.Navigation("Keys");
b.Navigation("Media");
b.Navigation("MultiplayerModes");
b.Navigation("PlaySessions");
b.Navigation("SavePaths");
b.Navigation("Scripts");
b.Navigation("Servers");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Media", b =>
{
b.Navigation("Parent");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Page", b =>
{
b.Navigation("Children");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Redistributable", b =>
{
b.Navigation("Archives");
b.Navigation("Scripts");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.Server", b =>
{
b.Navigation("Actions");
b.Navigation("HttpPaths");
b.Navigation("Scripts");
b.Navigation("ServerConsoles");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.StorageLocation", b =>
{
b.Navigation("Archives");
b.Navigation("GameSaves");
b.Navigation("Media");
});
modelBuilder.Entity("LANCommander.Server.Data.Models.User", b =>
{
b.Navigation("CustomFields");
b.Navigation("GameSaves");
b.Navigation("Media");
b.Navigation("PlaySessions");
});
#pragma warning restore 612, 618
}
}
}