Fix game deletions not working due to relationship with game saves, save paths, and play sessions
parent
d0d6701380
commit
ffa24dbecc
|
@ -17,6 +17,25 @@ namespace LANCommander.Data
|
|||
{
|
||||
base.OnModelCreating(builder);
|
||||
|
||||
builder.ConfigureBaseRelationships<Data.Models.Action>();
|
||||
builder.ConfigureBaseRelationships<Archive>();
|
||||
builder.ConfigureBaseRelationships<Category>();
|
||||
builder.ConfigureBaseRelationships<Company>();
|
||||
builder.ConfigureBaseRelationships<Game>();
|
||||
builder.ConfigureBaseRelationships<GameSave>();
|
||||
builder.ConfigureBaseRelationships<Genre>();
|
||||
builder.ConfigureBaseRelationships<Key>();
|
||||
builder.ConfigureBaseRelationships<Media>();
|
||||
builder.ConfigureBaseRelationships<MultiplayerMode>();
|
||||
builder.ConfigureBaseRelationships<PlaySession>();
|
||||
builder.ConfigureBaseRelationships<Redistributable>();
|
||||
builder.ConfigureBaseRelationships<SavePath>();
|
||||
builder.ConfigureBaseRelationships<Script>();
|
||||
builder.ConfigureBaseRelationships<Server>();
|
||||
builder.ConfigureBaseRelationships<ServerConsole>();
|
||||
builder.ConfigureBaseRelationships<ServerHttpPath>();
|
||||
builder.ConfigureBaseRelationships<Tag>();
|
||||
|
||||
builder.Entity<Genre>()
|
||||
.HasMany(g => g.Games)
|
||||
.WithMany(g => g.Genres);
|
||||
|
@ -34,6 +53,7 @@ namespace LANCommander.Data
|
|||
.HasMany(t => t.Games)
|
||||
.WithMany(g => g.Tags);
|
||||
|
||||
#region Game Relationships
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.Archives)
|
||||
.WithOne(g => g.Game)
|
||||
|
@ -63,6 +83,28 @@ namespace LANCommander.Data
|
|||
.IsRequired(true)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.Media)
|
||||
.WithOne(m => m.Game)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.SavePaths)
|
||||
.WithOne(p => p.Game)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.PlaySessions)
|
||||
.WithOne(ps => ps.Game)
|
||||
.IsRequired(false)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.GameSaves)
|
||||
.WithOne(gs => gs.Game)
|
||||
.IsRequired(false)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.Developers)
|
||||
.WithMany(c => c.DevelopedGames)
|
||||
|
@ -89,41 +131,28 @@ namespace LANCommander.Data
|
|||
gr => gr.HasOne<Redistributable>().WithMany().HasForeignKey("RedistributableId"),
|
||||
gr => gr.HasOne<Game>().WithMany().HasForeignKey("GameId")
|
||||
);
|
||||
#endregion
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.Media)
|
||||
.WithOne(m => m.Game)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
#region User Relationships
|
||||
builder.Entity<User>()
|
||||
.HasMany(u => u.GameSaves)
|
||||
.WithOne(gs => gs.User)
|
||||
.IsRequired(true)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.GameSaves)
|
||||
.WithOne(gs => gs.Game)
|
||||
.IsRequired(true)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.Entity<User>()
|
||||
.HasMany(u => u.PlaySessions)
|
||||
.WithOne(ps => ps.User)
|
||||
.IsRequired(true)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
#endregion
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.PlaySessions)
|
||||
.WithOne(ps => ps.Game)
|
||||
.IsRequired(true)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
#region Server Relationships
|
||||
builder.Entity<Server>()
|
||||
.HasOne(s => s.Game)
|
||||
.WithMany(g => g.Servers)
|
||||
.IsRequired(false)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
builder.Entity<Server>()
|
||||
.HasMany<ServerConsole>()
|
||||
|
@ -136,7 +165,9 @@ namespace LANCommander.Data
|
|||
.WithOne(s => s.Server)
|
||||
.IsRequired(true)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
#endregion
|
||||
|
||||
#region Redistributable Relationships
|
||||
builder.Entity<Redistributable>()
|
||||
.HasMany(r => r.Archives)
|
||||
.WithOne(a => a.Redistributable)
|
||||
|
@ -148,6 +179,7 @@ namespace LANCommander.Data
|
|||
.WithOne(s => s.Redistributable)
|
||||
.IsRequired(false)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
#endregion
|
||||
}
|
||||
|
||||
public DbSet<Game>? Games { get; set; }
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
using LANCommander.Data.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LANCommander.Data
|
||||
{
|
||||
public static class ModelBuilderExtensions
|
||||
{
|
||||
public static void ConfigureBaseRelationships<T>(this ModelBuilder modelBuilder) where T : BaseModel
|
||||
{
|
||||
modelBuilder.Entity<T>()
|
||||
.HasOne(x => x.CreatedBy)
|
||||
.WithMany()
|
||||
.IsRequired(false)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
modelBuilder.Entity<T>()
|
||||
.HasOne(x => x.UpdatedBy)
|
||||
.WithMany()
|
||||
.IsRequired(false)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,10 +10,13 @@ namespace LANCommander.Data.Models
|
|||
|
||||
[Display(Name = "Created On")]
|
||||
public DateTime CreatedOn { get; set; }
|
||||
|
||||
[Display(Name = "Created By")]
|
||||
public virtual User? CreatedBy { get; set; }
|
||||
|
||||
[Display(Name = "Updated On")]
|
||||
public DateTime UpdatedOn { get; set; }
|
||||
|
||||
[Display(Name = "Updated By")]
|
||||
public virtual User? UpdatedBy { get; set; }
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace LANCommander.Data.Models
|
|||
[Table("GameSaves")]
|
||||
public class GameSave : BaseModel
|
||||
{
|
||||
public Guid GameId { get; set; }
|
||||
public Guid? GameId { get; set; }
|
||||
[JsonIgnore]
|
||||
[ForeignKey(nameof(GameId))]
|
||||
[InverseProperty("GameSaves")]
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace LANCommander.Data.Models
|
|||
[Table("PlaySessions")]
|
||||
public class PlaySession : BaseModel
|
||||
{
|
||||
public Guid GameId { get; set; }
|
||||
public Guid? GameId { get; set; }
|
||||
[JsonIgnore]
|
||||
[ForeignKey(nameof(GameId))]
|
||||
[InverseProperty("PlaySessions")]
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,975 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LANCommander.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class FixDeletionBehaviors : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Actions_AspNetUsers_CreatedById",
|
||||
table: "Actions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Actions_AspNetUsers_UpdatedById",
|
||||
table: "Actions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Archive_AspNetUsers_CreatedById",
|
||||
table: "Archive");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Archive_AspNetUsers_UpdatedById",
|
||||
table: "Archive");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Categories_AspNetUsers_CreatedById",
|
||||
table: "Categories");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Categories_AspNetUsers_UpdatedById",
|
||||
table: "Categories");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Companies_AspNetUsers_CreatedById",
|
||||
table: "Companies");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Companies_AspNetUsers_UpdatedById",
|
||||
table: "Companies");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Games_AspNetUsers_CreatedById",
|
||||
table: "Games");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Games_AspNetUsers_UpdatedById",
|
||||
table: "Games");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GameSaves_AspNetUsers_CreatedById",
|
||||
table: "GameSaves");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GameSaves_AspNetUsers_UpdatedById",
|
||||
table: "GameSaves");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GameSaves_Games_GameId",
|
||||
table: "GameSaves");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Genres_AspNetUsers_CreatedById",
|
||||
table: "Genres");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Genres_AspNetUsers_UpdatedById",
|
||||
table: "Genres");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Keys_AspNetUsers_CreatedById",
|
||||
table: "Keys");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Keys_AspNetUsers_UpdatedById",
|
||||
table: "Keys");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Media_AspNetUsers_CreatedById",
|
||||
table: "Media");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Media_AspNetUsers_UpdatedById",
|
||||
table: "Media");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MultiplayerModes_AspNetUsers_CreatedById",
|
||||
table: "MultiplayerModes");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MultiplayerModes_AspNetUsers_UpdatedById",
|
||||
table: "MultiplayerModes");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlaySessions_AspNetUsers_CreatedById",
|
||||
table: "PlaySessions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlaySessions_AspNetUsers_UpdatedById",
|
||||
table: "PlaySessions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlaySessions_Games_GameId",
|
||||
table: "PlaySessions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Redistributables_AspNetUsers_CreatedById",
|
||||
table: "Redistributables");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Redistributables_AspNetUsers_UpdatedById",
|
||||
table: "Redistributables");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SavePaths_AspNetUsers_CreatedById",
|
||||
table: "SavePaths");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SavePaths_AspNetUsers_UpdatedById",
|
||||
table: "SavePaths");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SavePaths_Games_GameId",
|
||||
table: "SavePaths");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Scripts_AspNetUsers_CreatedById",
|
||||
table: "Scripts");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Scripts_AspNetUsers_UpdatedById",
|
||||
table: "Scripts");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ServerConsoles_AspNetUsers_CreatedById",
|
||||
table: "ServerConsoles");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ServerConsoles_AspNetUsers_UpdatedById",
|
||||
table: "ServerConsoles");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ServerHttpPath_AspNetUsers_CreatedById",
|
||||
table: "ServerHttpPath");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ServerHttpPath_AspNetUsers_UpdatedById",
|
||||
table: "ServerHttpPath");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Servers_AspNetUsers_CreatedById",
|
||||
table: "Servers");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Servers_AspNetUsers_UpdatedById",
|
||||
table: "Servers");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Servers_Games_GameId",
|
||||
table: "Servers");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Tags_AspNetUsers_CreatedById",
|
||||
table: "Tags");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Tags_AspNetUsers_UpdatedById",
|
||||
table: "Tags");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "GameId",
|
||||
table: "PlaySessions",
|
||||
type: "TEXT",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "TEXT");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "GameId",
|
||||
table: "GameSaves",
|
||||
type: "TEXT",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "TEXT");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Actions_AspNetUsers_CreatedById",
|
||||
table: "Actions",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Actions_AspNetUsers_UpdatedById",
|
||||
table: "Actions",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Archive_AspNetUsers_CreatedById",
|
||||
table: "Archive",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Archive_AspNetUsers_UpdatedById",
|
||||
table: "Archive",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Categories_AspNetUsers_CreatedById",
|
||||
table: "Categories",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Categories_AspNetUsers_UpdatedById",
|
||||
table: "Categories",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Companies_AspNetUsers_CreatedById",
|
||||
table: "Companies",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Companies_AspNetUsers_UpdatedById",
|
||||
table: "Companies",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Games_AspNetUsers_CreatedById",
|
||||
table: "Games",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Games_AspNetUsers_UpdatedById",
|
||||
table: "Games",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GameSaves_AspNetUsers_CreatedById",
|
||||
table: "GameSaves",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GameSaves_AspNetUsers_UpdatedById",
|
||||
table: "GameSaves",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GameSaves_Games_GameId",
|
||||
table: "GameSaves",
|
||||
column: "GameId",
|
||||
principalTable: "Games",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Genres_AspNetUsers_CreatedById",
|
||||
table: "Genres",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Genres_AspNetUsers_UpdatedById",
|
||||
table: "Genres",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Keys_AspNetUsers_CreatedById",
|
||||
table: "Keys",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Keys_AspNetUsers_UpdatedById",
|
||||
table: "Keys",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Media_AspNetUsers_CreatedById",
|
||||
table: "Media",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Media_AspNetUsers_UpdatedById",
|
||||
table: "Media",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MultiplayerModes_AspNetUsers_CreatedById",
|
||||
table: "MultiplayerModes",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MultiplayerModes_AspNetUsers_UpdatedById",
|
||||
table: "MultiplayerModes",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlaySessions_AspNetUsers_CreatedById",
|
||||
table: "PlaySessions",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlaySessions_AspNetUsers_UpdatedById",
|
||||
table: "PlaySessions",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlaySessions_Games_GameId",
|
||||
table: "PlaySessions",
|
||||
column: "GameId",
|
||||
principalTable: "Games",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Redistributables_AspNetUsers_CreatedById",
|
||||
table: "Redistributables",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Redistributables_AspNetUsers_UpdatedById",
|
||||
table: "Redistributables",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SavePaths_AspNetUsers_CreatedById",
|
||||
table: "SavePaths",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SavePaths_AspNetUsers_UpdatedById",
|
||||
table: "SavePaths",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SavePaths_Games_GameId",
|
||||
table: "SavePaths",
|
||||
column: "GameId",
|
||||
principalTable: "Games",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Scripts_AspNetUsers_CreatedById",
|
||||
table: "Scripts",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Scripts_AspNetUsers_UpdatedById",
|
||||
table: "Scripts",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ServerConsoles_AspNetUsers_CreatedById",
|
||||
table: "ServerConsoles",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ServerConsoles_AspNetUsers_UpdatedById",
|
||||
table: "ServerConsoles",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ServerHttpPath_AspNetUsers_CreatedById",
|
||||
table: "ServerHttpPath",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ServerHttpPath_AspNetUsers_UpdatedById",
|
||||
table: "ServerHttpPath",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Servers_AspNetUsers_CreatedById",
|
||||
table: "Servers",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Servers_AspNetUsers_UpdatedById",
|
||||
table: "Servers",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Servers_Games_GameId",
|
||||
table: "Servers",
|
||||
column: "GameId",
|
||||
principalTable: "Games",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Tags_AspNetUsers_CreatedById",
|
||||
table: "Tags",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Tags_AspNetUsers_UpdatedById",
|
||||
table: "Tags",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Actions_AspNetUsers_CreatedById",
|
||||
table: "Actions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Actions_AspNetUsers_UpdatedById",
|
||||
table: "Actions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Archive_AspNetUsers_CreatedById",
|
||||
table: "Archive");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Archive_AspNetUsers_UpdatedById",
|
||||
table: "Archive");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Categories_AspNetUsers_CreatedById",
|
||||
table: "Categories");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Categories_AspNetUsers_UpdatedById",
|
||||
table: "Categories");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Companies_AspNetUsers_CreatedById",
|
||||
table: "Companies");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Companies_AspNetUsers_UpdatedById",
|
||||
table: "Companies");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Games_AspNetUsers_CreatedById",
|
||||
table: "Games");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Games_AspNetUsers_UpdatedById",
|
||||
table: "Games");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GameSaves_AspNetUsers_CreatedById",
|
||||
table: "GameSaves");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GameSaves_AspNetUsers_UpdatedById",
|
||||
table: "GameSaves");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GameSaves_Games_GameId",
|
||||
table: "GameSaves");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Genres_AspNetUsers_CreatedById",
|
||||
table: "Genres");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Genres_AspNetUsers_UpdatedById",
|
||||
table: "Genres");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Keys_AspNetUsers_CreatedById",
|
||||
table: "Keys");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Keys_AspNetUsers_UpdatedById",
|
||||
table: "Keys");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Media_AspNetUsers_CreatedById",
|
||||
table: "Media");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Media_AspNetUsers_UpdatedById",
|
||||
table: "Media");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MultiplayerModes_AspNetUsers_CreatedById",
|
||||
table: "MultiplayerModes");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MultiplayerModes_AspNetUsers_UpdatedById",
|
||||
table: "MultiplayerModes");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlaySessions_AspNetUsers_CreatedById",
|
||||
table: "PlaySessions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlaySessions_AspNetUsers_UpdatedById",
|
||||
table: "PlaySessions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlaySessions_Games_GameId",
|
||||
table: "PlaySessions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Redistributables_AspNetUsers_CreatedById",
|
||||
table: "Redistributables");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Redistributables_AspNetUsers_UpdatedById",
|
||||
table: "Redistributables");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SavePaths_AspNetUsers_CreatedById",
|
||||
table: "SavePaths");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SavePaths_AspNetUsers_UpdatedById",
|
||||
table: "SavePaths");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SavePaths_Games_GameId",
|
||||
table: "SavePaths");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Scripts_AspNetUsers_CreatedById",
|
||||
table: "Scripts");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Scripts_AspNetUsers_UpdatedById",
|
||||
table: "Scripts");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ServerConsoles_AspNetUsers_CreatedById",
|
||||
table: "ServerConsoles");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ServerConsoles_AspNetUsers_UpdatedById",
|
||||
table: "ServerConsoles");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ServerHttpPath_AspNetUsers_CreatedById",
|
||||
table: "ServerHttpPath");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ServerHttpPath_AspNetUsers_UpdatedById",
|
||||
table: "ServerHttpPath");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Servers_AspNetUsers_CreatedById",
|
||||
table: "Servers");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Servers_AspNetUsers_UpdatedById",
|
||||
table: "Servers");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Servers_Games_GameId",
|
||||
table: "Servers");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Tags_AspNetUsers_CreatedById",
|
||||
table: "Tags");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Tags_AspNetUsers_UpdatedById",
|
||||
table: "Tags");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "GameId",
|
||||
table: "PlaySessions",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "TEXT",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "GameId",
|
||||
table: "GameSaves",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "TEXT",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Actions_AspNetUsers_CreatedById",
|
||||
table: "Actions",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Actions_AspNetUsers_UpdatedById",
|
||||
table: "Actions",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Archive_AspNetUsers_CreatedById",
|
||||
table: "Archive",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Archive_AspNetUsers_UpdatedById",
|
||||
table: "Archive",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Categories_AspNetUsers_CreatedById",
|
||||
table: "Categories",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Categories_AspNetUsers_UpdatedById",
|
||||
table: "Categories",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Companies_AspNetUsers_CreatedById",
|
||||
table: "Companies",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Companies_AspNetUsers_UpdatedById",
|
||||
table: "Companies",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Games_AspNetUsers_CreatedById",
|
||||
table: "Games",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Games_AspNetUsers_UpdatedById",
|
||||
table: "Games",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GameSaves_AspNetUsers_CreatedById",
|
||||
table: "GameSaves",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GameSaves_AspNetUsers_UpdatedById",
|
||||
table: "GameSaves",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GameSaves_Games_GameId",
|
||||
table: "GameSaves",
|
||||
column: "GameId",
|
||||
principalTable: "Games",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Genres_AspNetUsers_CreatedById",
|
||||
table: "Genres",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Genres_AspNetUsers_UpdatedById",
|
||||
table: "Genres",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Keys_AspNetUsers_CreatedById",
|
||||
table: "Keys",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Keys_AspNetUsers_UpdatedById",
|
||||
table: "Keys",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Media_AspNetUsers_CreatedById",
|
||||
table: "Media",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Media_AspNetUsers_UpdatedById",
|
||||
table: "Media",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MultiplayerModes_AspNetUsers_CreatedById",
|
||||
table: "MultiplayerModes",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MultiplayerModes_AspNetUsers_UpdatedById",
|
||||
table: "MultiplayerModes",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlaySessions_AspNetUsers_CreatedById",
|
||||
table: "PlaySessions",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlaySessions_AspNetUsers_UpdatedById",
|
||||
table: "PlaySessions",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlaySessions_Games_GameId",
|
||||
table: "PlaySessions",
|
||||
column: "GameId",
|
||||
principalTable: "Games",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Redistributables_AspNetUsers_CreatedById",
|
||||
table: "Redistributables",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Redistributables_AspNetUsers_UpdatedById",
|
||||
table: "Redistributables",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SavePaths_AspNetUsers_CreatedById",
|
||||
table: "SavePaths",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SavePaths_AspNetUsers_UpdatedById",
|
||||
table: "SavePaths",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SavePaths_Games_GameId",
|
||||
table: "SavePaths",
|
||||
column: "GameId",
|
||||
principalTable: "Games",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Scripts_AspNetUsers_CreatedById",
|
||||
table: "Scripts",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Scripts_AspNetUsers_UpdatedById",
|
||||
table: "Scripts",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ServerConsoles_AspNetUsers_CreatedById",
|
||||
table: "ServerConsoles",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ServerConsoles_AspNetUsers_UpdatedById",
|
||||
table: "ServerConsoles",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ServerHttpPath_AspNetUsers_CreatedById",
|
||||
table: "ServerHttpPath",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ServerHttpPath_AspNetUsers_UpdatedById",
|
||||
table: "ServerHttpPath",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Servers_AspNetUsers_CreatedById",
|
||||
table: "Servers",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Servers_AspNetUsers_UpdatedById",
|
||||
table: "Servers",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Servers_Games_GameId",
|
||||
table: "Servers",
|
||||
column: "GameId",
|
||||
principalTable: "Games",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Tags_AspNetUsers_CreatedById",
|
||||
table: "Tags",
|
||||
column: "CreatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Tags_AspNetUsers_UpdatedById",
|
||||
table: "Tags",
|
||||
column: "UpdatedById",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -355,7 +355,7 @@ namespace LANCommander.Migrations
|
|||
b.Property<DateTime>("CreatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("GameId")
|
||||
b.Property<Guid?>("GameId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid?>("UpdatedById")
|
||||
|
@ -585,7 +585,7 @@ namespace LANCommander.Migrations
|
|||
b.Property<DateTime?>("End")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("GameId")
|
||||
b.Property<Guid?>("GameId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("Start")
|
||||
|
@ -1248,7 +1248,8 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("Actions")
|
||||
|
@ -1258,7 +1259,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1271,7 +1273,8 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("Archives")
|
||||
|
@ -1289,7 +1292,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1306,7 +1310,8 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Category", "Parent")
|
||||
.WithMany("Children")
|
||||
|
@ -1314,7 +1319,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1327,11 +1333,13 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1342,11 +1350,13 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1357,17 +1367,18 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("GameSaves")
|
||||
.HasForeignKey("GameId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "User")
|
||||
.WithMany("GameSaves")
|
||||
|
@ -1388,11 +1399,13 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1407,7 +1420,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("Keys")
|
||||
|
@ -1417,7 +1431,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("ClaimedByUser");
|
||||
|
||||
|
@ -1432,7 +1447,8 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("Media")
|
||||
|
@ -1442,7 +1458,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1455,7 +1472,8 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("MultiplayerModes")
|
||||
|
@ -1465,7 +1483,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1478,17 +1497,18 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("PlaySessions")
|
||||
.HasForeignKey("GameId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "User")
|
||||
.WithMany("PlaySessions")
|
||||
|
@ -1509,11 +1529,13 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1524,15 +1546,18 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("SavePaths")
|
||||
.HasForeignKey("GameId");
|
||||
.HasForeignKey("GameId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1545,7 +1570,8 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("Scripts")
|
||||
|
@ -1559,7 +1585,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1574,16 +1601,18 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||
.WithMany("Servers")
|
||||
.HasForeignKey("GameId")
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1596,7 +1625,8 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Server", "Server")
|
||||
.WithMany()
|
||||
|
@ -1610,7 +1640,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1623,7 +1654,8 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.Server", "Server")
|
||||
.WithMany()
|
||||
|
@ -1637,7 +1669,8 @@ namespace LANCommander.Migrations
|
|||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
@ -1650,11 +1683,13 @@ namespace LANCommander.Migrations
|
|||
{
|
||||
b.HasOne("LANCommander.Data.Models.User", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById");
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("LANCommander.Data.Models.User", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
.HasForeignKey("UpdatedById")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<div style="padding: 0 24px;">
|
||||
<Table TItem="GameSave" DataSource="@GameSaves">
|
||||
<PropertyColumn Property="s => s.Game.Title" Sortable />
|
||||
<PropertyColumn Property="s => (s.Game == null ? String.Empty : s.Game.Title)" Sortable Title="Game" />
|
||||
<PropertyColumn Property="s => s.CreatedOn" Format="MM/dd/yyyy hh:mm tt" Sortable />
|
||||
<ActionColumn Title="" Style="text-align: right; white-space: nowrap">
|
||||
<Space Direction="DirectionVHType.Horizontal">
|
||||
|
@ -45,7 +45,7 @@
|
|||
User = await UserManager.FindByNameAsync(authState.User.Identity.Name);
|
||||
|
||||
if (User != null)
|
||||
GameSaves = User.GameSaves.OrderBy(s => s.Game.Title).ThenBy(s => s.CreatedOn).ToList();
|
||||
GameSaves = User.GameSaves.OrderBy(s => s.Game?.Title).ThenBy(s => s.CreatedOn).ToList();
|
||||
|
||||
Loading = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue