From dcce8364201a8b82c40d3541b3ec29fa7e5ae5cf Mon Sep 17 00:00:00 2001 From: Pat Hartl Date: Sun, 8 Jan 2023 21:43:01 -0600 Subject: [PATCH] Start migrating manifests to database --- LANCommander/Data/DatabaseContext.cs | 54 +- LANCommander/Data/Enums/MultiplayerType.cs | 9 + LANCommander/Data/Enums/NetworkProtocol.cs | 13 + LANCommander/Data/Models/Action.cs | 16 + LANCommander/Data/Models/Category.cs | 13 + LANCommander/Data/Models/Game.cs | 13 +- LANCommander/Data/Models/Genre.cs | 11 + LANCommander/Data/Models/MultiplayerMode.cs | 18 + ...230109032336_ManifestMigration.Designer.cs | 1018 +++++++++++++++++ .../20230109032336_ManifestMigration.cs | 415 +++++++ .../DatabaseContextModelSnapshot.cs | 402 ++++++- 11 files changed, 1947 insertions(+), 35 deletions(-) create mode 100644 LANCommander/Data/Enums/MultiplayerType.cs create mode 100644 LANCommander/Data/Enums/NetworkProtocol.cs create mode 100644 LANCommander/Data/Models/Action.cs create mode 100644 LANCommander/Data/Models/Category.cs create mode 100644 LANCommander/Data/Models/Genre.cs create mode 100644 LANCommander/Data/Models/MultiplayerMode.cs create mode 100644 LANCommander/Migrations/20230109032336_ManifestMigration.Designer.cs create mode 100644 LANCommander/Migrations/20230109032336_ManifestMigration.cs diff --git a/LANCommander/Data/DatabaseContext.cs b/LANCommander/Data/DatabaseContext.cs index 19f9f5b..3ca4540 100644 --- a/LANCommander/Data/DatabaseContext.cs +++ b/LANCommander/Data/DatabaseContext.cs @@ -16,15 +16,22 @@ namespace LANCommander.Data { base.OnModelCreating(builder); - builder.Entity() - .HasMany(c => c.PublishedGames) - .WithOne(g => g.Publisher) + builder.Entity() + .HasMany(g => g.Games) + .WithMany(g => g.Genres); + + builder.Entity() + .HasMany(c => c.Games) + .WithMany(g => g.Categories); + + builder.Entity() + .HasMany(c => c.Children) + .WithOne(c => c.Parent) .IsRequired(false); - builder.Entity() - .HasMany(c => c.DevelopedGames) - .WithOne(g => g.Developer) - .IsRequired(false); + builder.Entity() + .HasMany(t => t.Games) + .WithMany(g => g.Tags); builder.Entity() .HasMany(g => g.Archives) @@ -35,10 +42,43 @@ namespace LANCommander.Data .HasMany(g => g.Keys) .WithOne(g => g.Game) .IsRequired(false); + + builder.Entity() + .HasMany(g => g.Actions) + .WithOne(g => g.Game) + .OnDelete(DeleteBehavior.Cascade); + + builder.Entity() + .HasMany(g => g.MultiplayerModes) + .WithOne(m => m.Game) + .IsRequired(true) + .OnDelete(DeleteBehavior.Cascade); + + builder.Entity() + .HasMany(g => g.Developers) + .WithMany(c => c.DevelopedGames) + .UsingEntity>( + "GameDeveloper", + g => g.HasOne().WithMany().HasForeignKey("DeveloperId"), + g => g.HasOne().WithMany().HasForeignKey("GameId") + ); + + builder.Entity() + .HasMany(g => g.Publishers) + .WithMany(c => c.PublishedGames) + .UsingEntity>( + "GamePublisher", + g => g.HasOne().WithMany().HasForeignKey("PublisherId"), + g => g.HasOne().WithMany().HasForeignKey("GameId") + ); } public DbSet? Games { get; set; } + public DbSet? Genres { get; set; } + + public DbSet? Categories { get; set; } + public DbSet? Tags { get; set; } public DbSet? Companies { get; set; } diff --git a/LANCommander/Data/Enums/MultiplayerType.cs b/LANCommander/Data/Enums/MultiplayerType.cs new file mode 100644 index 0000000..6666e04 --- /dev/null +++ b/LANCommander/Data/Enums/MultiplayerType.cs @@ -0,0 +1,9 @@ +namespace LANCommander.Data.Enums +{ + public enum MultiplayerType + { + Local, + Lan, + Online + } +} diff --git a/LANCommander/Data/Enums/NetworkProtocol.cs b/LANCommander/Data/Enums/NetworkProtocol.cs new file mode 100644 index 0000000..05304e0 --- /dev/null +++ b/LANCommander/Data/Enums/NetworkProtocol.cs @@ -0,0 +1,13 @@ +using System.ComponentModel.DataAnnotations; + +namespace LANCommander.Data.Enums +{ + public enum NetworkProtocol + { + [Display(Name = "TCP/IP")] + TCPIP, + IPX, + Modem, + Serial + } +} diff --git a/LANCommander/Data/Models/Action.cs b/LANCommander/Data/Models/Action.cs new file mode 100644 index 0000000..d99a993 --- /dev/null +++ b/LANCommander/Data/Models/Action.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations.Schema; + +namespace LANCommander.Data.Models +{ + [Table("Actions")] + public class Action : BaseModel + { + public string Name { get; set; } + public string Arguments { get; set; } + public string Path { get; set; } + public string WorkingDirectory { get; set; } + public bool PrimaryAction { get; set; } + + public virtual Game Game { get; set; } + } +} diff --git a/LANCommander/Data/Models/Category.cs b/LANCommander/Data/Models/Category.cs new file mode 100644 index 0000000..99abfeb --- /dev/null +++ b/LANCommander/Data/Models/Category.cs @@ -0,0 +1,13 @@ +using System.ComponentModel.DataAnnotations.Schema; + +namespace LANCommander.Data.Models +{ + [Table("Categories")] + public class Category : BaseModel + { + public string Name { get; set; } + public virtual Category Parent { get; set; } + public virtual ICollection Children { get; set; } + public virtual ICollection Games { get; set; } + } +} diff --git a/LANCommander/Data/Models/Game.cs b/LANCommander/Data/Models/Game.cs index d045a67..e0c75e9 100644 --- a/LANCommander/Data/Models/Game.cs +++ b/LANCommander/Data/Models/Game.cs @@ -15,11 +15,16 @@ namespace LANCommander.Data.Models [Display(Name = "Released On")] public DateTime ReleasedOn { get; set; } + public virtual ICollection Actions { get; set; } + + public bool Singleplayer { get; set; } + + public virtual ICollection MultiplayerModes { get; set; } + public virtual ICollection Genres { get; set; } public virtual ICollection? Tags { get; set; } - - public virtual Company? Publisher { get; set; } - public virtual Company? Developer { get; set; } - + public virtual ICollection? Categories { get; set; } + public virtual ICollection Publishers { get; set; } + public virtual ICollection Developers { get; set; } public virtual ICollection? Archives { get; set; } public string? ValidKeyRegex { get; set; } diff --git a/LANCommander/Data/Models/Genre.cs b/LANCommander/Data/Models/Genre.cs new file mode 100644 index 0000000..13c5f02 --- /dev/null +++ b/LANCommander/Data/Models/Genre.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations.Schema; + +namespace LANCommander.Data.Models +{ + [Table("Genres")] + public class Genre : BaseModel + { + public string Name { get; set; } + public virtual ICollection Games { get; set; } + } +} diff --git a/LANCommander/Data/Models/MultiplayerMode.cs b/LANCommander/Data/Models/MultiplayerMode.cs new file mode 100644 index 0000000..a51ae8e --- /dev/null +++ b/LANCommander/Data/Models/MultiplayerMode.cs @@ -0,0 +1,18 @@ +using LANCommander.Data.Enums; +using System.ComponentModel.DataAnnotations.Schema; + +namespace LANCommander.Data.Models +{ + [Table("MultiplayerModes")] + public class MultiplayerMode : BaseModel + { + public MultiplayerType Type { get; set; } + public NetworkProtocol NetworkProtocol { get; set; } + public string Description { get; set; } + public int MinPlayers { get; set; } + public int MaxPlayers { get; set; } + public int Spectators { get; set; } + + public virtual Game Game { get; set; } + } +} diff --git a/LANCommander/Migrations/20230109032336_ManifestMigration.Designer.cs b/LANCommander/Migrations/20230109032336_ManifestMigration.Designer.cs new file mode 100644 index 0000000..b0ec63f --- /dev/null +++ b/LANCommander/Migrations/20230109032336_ManifestMigration.Designer.cs @@ -0,0 +1,1018 @@ +// +using System; +using LANCommander.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace LANCommander.Migrations +{ + [DbContext(typeof(DatabaseContext))] + [Migration("20230109032336_ManifestMigration")] + partial class ManifestMigration + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.8"); + + modelBuilder.Entity("CategoryGame", b => + { + b.Property("CategoriesId") + .HasColumnType("TEXT"); + + b.Property("GamesId") + .HasColumnType("TEXT"); + + b.HasKey("CategoriesId", "GamesId"); + + b.HasIndex("GamesId"); + + b.ToTable("CategoryGame"); + }); + + modelBuilder.Entity("GameDeveloper", b => + { + b.Property("DeveloperId") + .HasColumnType("TEXT"); + + b.Property("GameId") + .HasColumnType("TEXT"); + + b.HasKey("DeveloperId", "GameId"); + + b.HasIndex("GameId"); + + b.ToTable("GameDeveloper"); + }); + + modelBuilder.Entity("GameGenre", b => + { + b.Property("GamesId") + .HasColumnType("TEXT"); + + b.Property("GenresId") + .HasColumnType("TEXT"); + + b.HasKey("GamesId", "GenresId"); + + b.HasIndex("GenresId"); + + b.ToTable("GameGenre"); + }); + + modelBuilder.Entity("GamePublisher", b => + { + b.Property("GameId") + .HasColumnType("TEXT"); + + b.Property("PublisherId") + .HasColumnType("TEXT"); + + b.HasKey("GameId", "PublisherId"); + + b.HasIndex("PublisherId"); + + b.ToTable("GamePublisher"); + }); + + modelBuilder.Entity("GameTag", b => + { + b.Property("GamesId") + .HasColumnType("TEXT"); + + b.Property("TagsId") + .HasColumnType("TEXT"); + + b.HasKey("GamesId", "TagsId"); + + b.HasIndex("TagsId"); + + b.ToTable("GameTag"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Action", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Arguments") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedById") + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("GameId") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Path") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PrimaryAction") + .HasColumnType("INTEGER"); + + b.Property("UpdatedById") + .HasColumnType("TEXT"); + + b.Property("UpdatedOn") + .HasColumnType("TEXT"); + + b.Property("WorkingDirectory") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("GameId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Actions"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Archive", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Changelog") + .HasColumnType("TEXT"); + + b.Property("CompressedSize") + .HasColumnType("INTEGER"); + + b.Property("CreatedById") + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("GameId") + .HasColumnType("TEXT"); + + b.Property("LastVersionId") + .HasColumnType("TEXT"); + + b.Property("ObjectKey") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UncompressedSize") + .HasColumnType("INTEGER"); + + b.Property("UpdatedById") + .HasColumnType("TEXT"); + + b.Property("UpdatedOn") + .HasColumnType("TEXT"); + + b.Property("Version") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("GameId"); + + b.HasIndex("LastVersionId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Archive"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Category", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedById") + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ParentId") + .HasColumnType("TEXT"); + + b.Property("UpdatedById") + .HasColumnType("TEXT"); + + b.Property("UpdatedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("ParentId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Categories"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Company", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedById") + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UpdatedById") + .HasColumnType("TEXT"); + + b.Property("UpdatedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Companies"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Game", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedById") + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("DirectoryName") + .HasColumnType("TEXT"); + + b.Property("ReleasedOn") + .HasColumnType("TEXT"); + + b.Property("Singleplayer") + .HasColumnType("INTEGER"); + + b.Property("SortTitle") + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UpdatedById") + .HasColumnType("TEXT"); + + b.Property("UpdatedOn") + .HasColumnType("TEXT"); + + b.Property("ValidKeyRegex") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Games"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Genre", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedById") + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UpdatedById") + .HasColumnType("TEXT"); + + b.Property("UpdatedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Genres"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Key", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("AllocationMethod") + .HasColumnType("INTEGER"); + + b.Property("ClaimedByComputerName") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ClaimedByIpv4Address") + .HasMaxLength(15) + .HasColumnType("TEXT"); + + b.Property("ClaimedByMacAddress") + .HasMaxLength(17) + .HasColumnType("TEXT"); + + b.Property("ClaimedByUserId") + .HasColumnType("TEXT"); + + b.Property("ClaimedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedById") + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("GameId") + .HasColumnType("TEXT"); + + b.Property("UpdatedById") + .HasColumnType("TEXT"); + + b.Property("UpdatedOn") + .HasColumnType("TEXT"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ClaimedByUserId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("GameId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Keys"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.MultiplayerMode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedById") + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("GameId") + .HasColumnType("TEXT"); + + b.Property("MaxPlayers") + .HasColumnType("INTEGER"); + + b.Property("MinPlayers") + .HasColumnType("INTEGER"); + + b.Property("NetworkProtocol") + .HasColumnType("INTEGER"); + + b.Property("Spectators") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.Property("UpdatedById") + .HasColumnType("TEXT"); + + b.Property("UpdatedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("GameId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("MultiplayerModes"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedById") + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UpdatedById") + .HasColumnType("TEXT"); + + b.Property("UpdatedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Tags"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnd") + .HasColumnType("TEXT"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("PasswordHash") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); + + b.Property("RefreshToken") + .HasColumnType("TEXT"); + + b.Property("RefreshTokenExpiration") + .HasColumnType("TEXT"); + + b.Property("SecurityStamp") + .HasColumnType("TEXT"); + + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("ProviderKey") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("CategoryGame", b => + { + b.HasOne("LANCommander.Data.Models.Category", null) + .WithMany() + .HasForeignKey("CategoriesId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LANCommander.Data.Models.Game", null) + .WithMany() + .HasForeignKey("GamesId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("GameDeveloper", b => + { + b.HasOne("LANCommander.Data.Models.Company", null) + .WithMany() + .HasForeignKey("DeveloperId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LANCommander.Data.Models.Game", null) + .WithMany() + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("GameGenre", b => + { + b.HasOne("LANCommander.Data.Models.Game", null) + .WithMany() + .HasForeignKey("GamesId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LANCommander.Data.Models.Genre", null) + .WithMany() + .HasForeignKey("GenresId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("GamePublisher", b => + { + b.HasOne("LANCommander.Data.Models.Game", null) + .WithMany() + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LANCommander.Data.Models.Company", null) + .WithMany() + .HasForeignKey("PublisherId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("GameTag", b => + { + b.HasOne("LANCommander.Data.Models.Game", null) + .WithMany() + .HasForeignKey("GamesId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LANCommander.Data.Models.Tag", null) + .WithMany() + .HasForeignKey("TagsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Action", b => + { + b.HasOne("LANCommander.Data.Models.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById"); + + b.HasOne("LANCommander.Data.Models.Game", "Game") + .WithMany("Actions") + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LANCommander.Data.Models.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById"); + + b.Navigation("CreatedBy"); + + b.Navigation("Game"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Archive", b => + { + b.HasOne("LANCommander.Data.Models.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById"); + + b.HasOne("LANCommander.Data.Models.Game", "Game") + .WithMany("Archives") + .HasForeignKey("GameId"); + + b.HasOne("LANCommander.Data.Models.Archive", "LastVersion") + .WithMany() + .HasForeignKey("LastVersionId"); + + b.HasOne("LANCommander.Data.Models.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById"); + + b.Navigation("CreatedBy"); + + b.Navigation("Game"); + + b.Navigation("LastVersion"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Category", b => + { + b.HasOne("LANCommander.Data.Models.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById"); + + b.HasOne("LANCommander.Data.Models.Category", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId"); + + b.HasOne("LANCommander.Data.Models.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById"); + + b.Navigation("CreatedBy"); + + b.Navigation("Parent"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Company", b => + { + b.HasOne("LANCommander.Data.Models.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById"); + + b.HasOne("LANCommander.Data.Models.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById"); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Game", b => + { + b.HasOne("LANCommander.Data.Models.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById"); + + b.HasOne("LANCommander.Data.Models.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById"); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Genre", b => + { + b.HasOne("LANCommander.Data.Models.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById"); + + b.HasOne("LANCommander.Data.Models.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById"); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Key", b => + { + b.HasOne("LANCommander.Data.Models.User", "ClaimedByUser") + .WithMany() + .HasForeignKey("ClaimedByUserId"); + + b.HasOne("LANCommander.Data.Models.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById"); + + b.HasOne("LANCommander.Data.Models.Game", "Game") + .WithMany("Keys") + .HasForeignKey("GameId"); + + b.HasOne("LANCommander.Data.Models.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById"); + + b.Navigation("ClaimedByUser"); + + b.Navigation("CreatedBy"); + + b.Navigation("Game"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.MultiplayerMode", b => + { + b.HasOne("LANCommander.Data.Models.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById"); + + b.HasOne("LANCommander.Data.Models.Game", "Game") + .WithMany("MultiplayerModes") + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LANCommander.Data.Models.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById"); + + b.Navigation("CreatedBy"); + + b.Navigation("Game"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Tag", b => + { + b.HasOne("LANCommander.Data.Models.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById"); + + b.HasOne("LANCommander.Data.Models.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById"); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("LANCommander.Data.Models.Role", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("LANCommander.Data.Models.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("LANCommander.Data.Models.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("LANCommander.Data.Models.Role", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LANCommander.Data.Models.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("LANCommander.Data.Models.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Category", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("LANCommander.Data.Models.Game", b => + { + b.Navigation("Actions"); + + b.Navigation("Archives"); + + b.Navigation("Keys"); + + b.Navigation("MultiplayerModes"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/LANCommander/Migrations/20230109032336_ManifestMigration.cs b/LANCommander/Migrations/20230109032336_ManifestMigration.cs new file mode 100644 index 0000000..9ac3cad --- /dev/null +++ b/LANCommander/Migrations/20230109032336_ManifestMigration.cs @@ -0,0 +1,415 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace LANCommander.Migrations +{ + public partial class ManifestMigration : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Games_Companies_DeveloperId", + table: "Games"); + + migrationBuilder.DropForeignKey( + name: "FK_Games_Companies_PublisherId", + table: "Games"); + + migrationBuilder.DropIndex( + name: "IX_Games_DeveloperId", + table: "Games"); + + migrationBuilder.DropIndex( + name: "IX_Games_PublisherId", + table: "Games"); + + migrationBuilder.DropColumn( + name: "DeveloperId", + table: "Games"); + + migrationBuilder.DropColumn( + name: "PublisherId", + table: "Games"); + + migrationBuilder.AddColumn( + name: "Singleplayer", + table: "Games", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.CreateTable( + name: "Actions", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + Arguments = table.Column(type: "TEXT", nullable: false), + Path = table.Column(type: "TEXT", nullable: false), + WorkingDirectory = table.Column(type: "TEXT", nullable: false), + PrimaryAction = table.Column(type: "INTEGER", nullable: false), + GameId = table.Column(type: "TEXT", nullable: false), + CreatedOn = table.Column(type: "TEXT", nullable: false), + CreatedById = table.Column(type: "TEXT", nullable: true), + UpdatedOn = table.Column(type: "TEXT", nullable: false), + UpdatedById = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Actions", x => x.Id); + table.ForeignKey( + name: "FK_Actions_AspNetUsers_CreatedById", + column: x => x.CreatedById, + principalTable: "AspNetUsers", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Actions_AspNetUsers_UpdatedById", + column: x => x.UpdatedById, + principalTable: "AspNetUsers", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Actions_Games_GameId", + column: x => x.GameId, + principalTable: "Games", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Categories", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + ParentId = table.Column(type: "TEXT", nullable: false), + CreatedOn = table.Column(type: "TEXT", nullable: false), + CreatedById = table.Column(type: "TEXT", nullable: true), + UpdatedOn = table.Column(type: "TEXT", nullable: false), + UpdatedById = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Categories", x => x.Id); + table.ForeignKey( + name: "FK_Categories_AspNetUsers_CreatedById", + column: x => x.CreatedById, + principalTable: "AspNetUsers", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Categories_AspNetUsers_UpdatedById", + column: x => x.UpdatedById, + principalTable: "AspNetUsers", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Categories_Categories_ParentId", + column: x => x.ParentId, + principalTable: "Categories", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "GameDeveloper", + columns: table => new + { + DeveloperId = table.Column(type: "TEXT", nullable: false), + GameId = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_GameDeveloper", x => new { x.DeveloperId, x.GameId }); + table.ForeignKey( + name: "FK_GameDeveloper_Companies_DeveloperId", + column: x => x.DeveloperId, + principalTable: "Companies", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_GameDeveloper_Games_GameId", + column: x => x.GameId, + principalTable: "Games", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "GamePublisher", + columns: table => new + { + GameId = table.Column(type: "TEXT", nullable: false), + PublisherId = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_GamePublisher", x => new { x.GameId, x.PublisherId }); + table.ForeignKey( + name: "FK_GamePublisher_Companies_PublisherId", + column: x => x.PublisherId, + principalTable: "Companies", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_GamePublisher_Games_GameId", + column: x => x.GameId, + principalTable: "Games", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Genres", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + CreatedOn = table.Column(type: "TEXT", nullable: false), + CreatedById = table.Column(type: "TEXT", nullable: true), + UpdatedOn = table.Column(type: "TEXT", nullable: false), + UpdatedById = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Genres", x => x.Id); + table.ForeignKey( + name: "FK_Genres_AspNetUsers_CreatedById", + column: x => x.CreatedById, + principalTable: "AspNetUsers", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Genres_AspNetUsers_UpdatedById", + column: x => x.UpdatedById, + principalTable: "AspNetUsers", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "MultiplayerModes", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Type = table.Column(type: "INTEGER", nullable: false), + NetworkProtocol = table.Column(type: "INTEGER", nullable: false), + Description = table.Column(type: "TEXT", nullable: false), + MinPlayers = table.Column(type: "INTEGER", nullable: false), + MaxPlayers = table.Column(type: "INTEGER", nullable: false), + Spectators = table.Column(type: "INTEGER", nullable: false), + GameId = table.Column(type: "TEXT", nullable: false), + CreatedOn = table.Column(type: "TEXT", nullable: false), + CreatedById = table.Column(type: "TEXT", nullable: true), + UpdatedOn = table.Column(type: "TEXT", nullable: false), + UpdatedById = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_MultiplayerModes", x => x.Id); + table.ForeignKey( + name: "FK_MultiplayerModes_AspNetUsers_CreatedById", + column: x => x.CreatedById, + principalTable: "AspNetUsers", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_MultiplayerModes_AspNetUsers_UpdatedById", + column: x => x.UpdatedById, + principalTable: "AspNetUsers", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_MultiplayerModes_Games_GameId", + column: x => x.GameId, + principalTable: "Games", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "CategoryGame", + columns: table => new + { + CategoriesId = table.Column(type: "TEXT", nullable: false), + GamesId = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CategoryGame", x => new { x.CategoriesId, x.GamesId }); + table.ForeignKey( + name: "FK_CategoryGame_Categories_CategoriesId", + column: x => x.CategoriesId, + principalTable: "Categories", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CategoryGame_Games_GamesId", + column: x => x.GamesId, + principalTable: "Games", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "GameGenre", + columns: table => new + { + GamesId = table.Column(type: "TEXT", nullable: false), + GenresId = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_GameGenre", x => new { x.GamesId, x.GenresId }); + table.ForeignKey( + name: "FK_GameGenre_Games_GamesId", + column: x => x.GamesId, + principalTable: "Games", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_GameGenre_Genres_GenresId", + column: x => x.GenresId, + principalTable: "Genres", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Actions_CreatedById", + table: "Actions", + column: "CreatedById"); + + migrationBuilder.CreateIndex( + name: "IX_Actions_GameId", + table: "Actions", + column: "GameId"); + + migrationBuilder.CreateIndex( + name: "IX_Actions_UpdatedById", + table: "Actions", + column: "UpdatedById"); + + migrationBuilder.CreateIndex( + name: "IX_Categories_CreatedById", + table: "Categories", + column: "CreatedById"); + + migrationBuilder.CreateIndex( + name: "IX_Categories_ParentId", + table: "Categories", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_Categories_UpdatedById", + table: "Categories", + column: "UpdatedById"); + + migrationBuilder.CreateIndex( + name: "IX_CategoryGame_GamesId", + table: "CategoryGame", + column: "GamesId"); + + migrationBuilder.CreateIndex( + name: "IX_GameDeveloper_GameId", + table: "GameDeveloper", + column: "GameId"); + + migrationBuilder.CreateIndex( + name: "IX_GameGenre_GenresId", + table: "GameGenre", + column: "GenresId"); + + migrationBuilder.CreateIndex( + name: "IX_GamePublisher_PublisherId", + table: "GamePublisher", + column: "PublisherId"); + + migrationBuilder.CreateIndex( + name: "IX_Genres_CreatedById", + table: "Genres", + column: "CreatedById"); + + migrationBuilder.CreateIndex( + name: "IX_Genres_UpdatedById", + table: "Genres", + column: "UpdatedById"); + + migrationBuilder.CreateIndex( + name: "IX_MultiplayerModes_CreatedById", + table: "MultiplayerModes", + column: "CreatedById"); + + migrationBuilder.CreateIndex( + name: "IX_MultiplayerModes_GameId", + table: "MultiplayerModes", + column: "GameId"); + + migrationBuilder.CreateIndex( + name: "IX_MultiplayerModes_UpdatedById", + table: "MultiplayerModes", + column: "UpdatedById"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Actions"); + + migrationBuilder.DropTable( + name: "CategoryGame"); + + migrationBuilder.DropTable( + name: "GameDeveloper"); + + migrationBuilder.DropTable( + name: "GameGenre"); + + migrationBuilder.DropTable( + name: "GamePublisher"); + + migrationBuilder.DropTable( + name: "MultiplayerModes"); + + migrationBuilder.DropTable( + name: "Categories"); + + migrationBuilder.DropTable( + name: "Genres"); + + migrationBuilder.DropColumn( + name: "Singleplayer", + table: "Games"); + + migrationBuilder.AddColumn( + name: "DeveloperId", + table: "Games", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "PublisherId", + table: "Games", + type: "TEXT", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Games_DeveloperId", + table: "Games", + column: "DeveloperId"); + + migrationBuilder.CreateIndex( + name: "IX_Games_PublisherId", + table: "Games", + column: "PublisherId"); + + migrationBuilder.AddForeignKey( + name: "FK_Games_Companies_DeveloperId", + table: "Games", + column: "DeveloperId", + principalTable: "Companies", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_Games_Companies_PublisherId", + table: "Games", + column: "PublisherId", + principalTable: "Companies", + principalColumn: "Id"); + } + } +} diff --git a/LANCommander/Migrations/DatabaseContextModelSnapshot.cs b/LANCommander/Migrations/DatabaseContextModelSnapshot.cs index ae0e643..492c4e3 100644 --- a/LANCommander/Migrations/DatabaseContextModelSnapshot.cs +++ b/LANCommander/Migrations/DatabaseContextModelSnapshot.cs @@ -17,6 +17,66 @@ namespace LANCommander.Migrations #pragma warning disable 612, 618 modelBuilder.HasAnnotation("ProductVersion", "6.0.8"); + modelBuilder.Entity("CategoryGame", b => + { + b.Property("CategoriesId") + .HasColumnType("TEXT"); + + b.Property("GamesId") + .HasColumnType("TEXT"); + + b.HasKey("CategoriesId", "GamesId"); + + b.HasIndex("GamesId"); + + b.ToTable("CategoryGame"); + }); + + modelBuilder.Entity("GameDeveloper", b => + { + b.Property("DeveloperId") + .HasColumnType("TEXT"); + + b.Property("GameId") + .HasColumnType("TEXT"); + + b.HasKey("DeveloperId", "GameId"); + + b.HasIndex("GameId"); + + b.ToTable("GameDeveloper"); + }); + + modelBuilder.Entity("GameGenre", b => + { + b.Property("GamesId") + .HasColumnType("TEXT"); + + b.Property("GenresId") + .HasColumnType("TEXT"); + + b.HasKey("GamesId", "GenresId"); + + b.HasIndex("GenresId"); + + b.ToTable("GameGenre"); + }); + + modelBuilder.Entity("GamePublisher", b => + { + b.Property("GameId") + .HasColumnType("TEXT"); + + b.Property("PublisherId") + .HasColumnType("TEXT"); + + b.HasKey("GameId", "PublisherId"); + + b.HasIndex("PublisherId"); + + b.ToTable("GamePublisher"); + }); + modelBuilder.Entity("GameTag", b => { b.Property("GamesId") @@ -32,6 +92,57 @@ namespace LANCommander.Migrations b.ToTable("GameTag"); }); + modelBuilder.Entity("LANCommander.Data.Models.Action", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Arguments") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedById") + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("GameId") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Path") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PrimaryAction") + .HasColumnType("INTEGER"); + + b.Property("UpdatedById") + .HasColumnType("TEXT"); + + b.Property("UpdatedOn") + .HasColumnType("TEXT"); + + b.Property("WorkingDirectory") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("GameId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Actions"); + }); + modelBuilder.Entity("LANCommander.Data.Models.Archive", b => { b.Property("Id") @@ -86,6 +197,42 @@ namespace LANCommander.Migrations b.ToTable("Archive"); }); + modelBuilder.Entity("LANCommander.Data.Models.Category", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedById") + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ParentId") + .HasColumnType("TEXT"); + + b.Property("UpdatedById") + .HasColumnType("TEXT"); + + b.Property("UpdatedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("ParentId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Categories"); + }); + modelBuilder.Entity("LANCommander.Data.Models.Company", b => { b.Property("Id") @@ -133,18 +280,15 @@ namespace LANCommander.Migrations .IsRequired() .HasColumnType("TEXT"); - b.Property("DeveloperId") - .HasColumnType("TEXT"); - b.Property("DirectoryName") .HasColumnType("TEXT"); - b.Property("PublisherId") - .HasColumnType("TEXT"); - b.Property("ReleasedOn") .HasColumnType("TEXT"); + b.Property("Singleplayer") + .HasColumnType("INTEGER"); + b.Property("SortTitle") .HasColumnType("TEXT"); @@ -165,15 +309,42 @@ namespace LANCommander.Migrations b.HasIndex("CreatedById"); - b.HasIndex("DeveloperId"); - - b.HasIndex("PublisherId"); - b.HasIndex("UpdatedById"); b.ToTable("Games"); }); + modelBuilder.Entity("LANCommander.Data.Models.Genre", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedById") + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UpdatedById") + .HasColumnType("TEXT"); + + b.Property("UpdatedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Genres"); + }); + modelBuilder.Entity("LANCommander.Data.Models.Key", b => { b.Property("Id") @@ -234,6 +405,57 @@ namespace LANCommander.Migrations b.ToTable("Keys"); }); + modelBuilder.Entity("LANCommander.Data.Models.MultiplayerMode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedById") + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("GameId") + .HasColumnType("TEXT"); + + b.Property("MaxPlayers") + .HasColumnType("INTEGER"); + + b.Property("MinPlayers") + .HasColumnType("INTEGER"); + + b.Property("NetworkProtocol") + .HasColumnType("INTEGER"); + + b.Property("Spectators") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.Property("UpdatedById") + .HasColumnType("TEXT"); + + b.Property("UpdatedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("GameId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("MultiplayerModes"); + }); + modelBuilder.Entity("LANCommander.Data.Models.Role", b => { b.Property("Id") @@ -466,6 +688,66 @@ namespace LANCommander.Migrations b.ToTable("AspNetUserTokens", (string)null); }); + modelBuilder.Entity("CategoryGame", b => + { + b.HasOne("LANCommander.Data.Models.Category", null) + .WithMany() + .HasForeignKey("CategoriesId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LANCommander.Data.Models.Game", null) + .WithMany() + .HasForeignKey("GamesId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("GameDeveloper", b => + { + b.HasOne("LANCommander.Data.Models.Company", null) + .WithMany() + .HasForeignKey("DeveloperId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LANCommander.Data.Models.Game", null) + .WithMany() + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("GameGenre", b => + { + b.HasOne("LANCommander.Data.Models.Game", null) + .WithMany() + .HasForeignKey("GamesId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LANCommander.Data.Models.Genre", null) + .WithMany() + .HasForeignKey("GenresId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("GamePublisher", b => + { + b.HasOne("LANCommander.Data.Models.Game", null) + .WithMany() + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LANCommander.Data.Models.Company", null) + .WithMany() + .HasForeignKey("PublisherId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("GameTag", b => { b.HasOne("LANCommander.Data.Models.Game", null) @@ -481,6 +763,29 @@ namespace LANCommander.Migrations .IsRequired(); }); + modelBuilder.Entity("LANCommander.Data.Models.Action", b => + { + b.HasOne("LANCommander.Data.Models.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById"); + + b.HasOne("LANCommander.Data.Models.Game", "Game") + .WithMany("Actions") + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LANCommander.Data.Models.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById"); + + b.Navigation("CreatedBy"); + + b.Navigation("Game"); + + b.Navigation("UpdatedBy"); + }); + modelBuilder.Entity("LANCommander.Data.Models.Archive", b => { b.HasOne("LANCommander.Data.Models.User", "CreatedBy") @@ -508,6 +813,27 @@ namespace LANCommander.Migrations b.Navigation("UpdatedBy"); }); + modelBuilder.Entity("LANCommander.Data.Models.Category", b => + { + b.HasOne("LANCommander.Data.Models.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById"); + + b.HasOne("LANCommander.Data.Models.Category", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId"); + + b.HasOne("LANCommander.Data.Models.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById"); + + b.Navigation("CreatedBy"); + + b.Navigation("Parent"); + + b.Navigation("UpdatedBy"); + }); + modelBuilder.Entity("LANCommander.Data.Models.Company", b => { b.HasOne("LANCommander.Data.Models.User", "CreatedBy") @@ -529,23 +855,26 @@ namespace LANCommander.Migrations .WithMany() .HasForeignKey("CreatedById"); - b.HasOne("LANCommander.Data.Models.Company", "Developer") - .WithMany("DevelopedGames") - .HasForeignKey("DeveloperId"); - - b.HasOne("LANCommander.Data.Models.Company", "Publisher") - .WithMany("PublishedGames") - .HasForeignKey("PublisherId"); - b.HasOne("LANCommander.Data.Models.User", "UpdatedBy") .WithMany() .HasForeignKey("UpdatedById"); b.Navigation("CreatedBy"); - b.Navigation("Developer"); + b.Navigation("UpdatedBy"); + }); - b.Navigation("Publisher"); + modelBuilder.Entity("LANCommander.Data.Models.Genre", b => + { + b.HasOne("LANCommander.Data.Models.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById"); + + b.HasOne("LANCommander.Data.Models.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById"); + + b.Navigation("CreatedBy"); b.Navigation("UpdatedBy"); }); @@ -577,6 +906,29 @@ namespace LANCommander.Migrations b.Navigation("UpdatedBy"); }); + modelBuilder.Entity("LANCommander.Data.Models.MultiplayerMode", b => + { + b.HasOne("LANCommander.Data.Models.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById"); + + b.HasOne("LANCommander.Data.Models.Game", "Game") + .WithMany("MultiplayerModes") + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LANCommander.Data.Models.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById"); + + b.Navigation("CreatedBy"); + + b.Navigation("Game"); + + b.Navigation("UpdatedBy"); + }); + modelBuilder.Entity("LANCommander.Data.Models.Tag", b => { b.HasOne("LANCommander.Data.Models.User", "CreatedBy") @@ -643,18 +995,20 @@ namespace LANCommander.Migrations .IsRequired(); }); - modelBuilder.Entity("LANCommander.Data.Models.Company", b => + modelBuilder.Entity("LANCommander.Data.Models.Category", b => { - b.Navigation("DevelopedGames"); - - b.Navigation("PublishedGames"); + b.Navigation("Children"); }); modelBuilder.Entity("LANCommander.Data.Models.Game", b => { + b.Navigation("Actions"); + b.Navigation("Archives"); b.Navigation("Keys"); + + b.Navigation("MultiplayerModes"); }); #pragma warning restore 612, 618 }