Start migrating manifests to database
This commit is contained in:
parent
c805c85b3e
commit
dcce836420
11 changed files with 1947 additions and 35 deletions
|
@ -16,15 +16,22 @@ namespace LANCommander.Data
|
|||
{
|
||||
base.OnModelCreating(builder);
|
||||
|
||||
builder.Entity<Company>()
|
||||
.HasMany(c => c.PublishedGames)
|
||||
.WithOne(g => g.Publisher)
|
||||
builder.Entity<Genre>()
|
||||
.HasMany(g => g.Games)
|
||||
.WithMany(g => g.Genres);
|
||||
|
||||
builder.Entity<Category>()
|
||||
.HasMany(c => c.Games)
|
||||
.WithMany(g => g.Categories);
|
||||
|
||||
builder.Entity<Category>()
|
||||
.HasMany(c => c.Children)
|
||||
.WithOne(c => c.Parent)
|
||||
.IsRequired(false);
|
||||
|
||||
builder.Entity<Company>()
|
||||
.HasMany(c => c.DevelopedGames)
|
||||
.WithOne(g => g.Developer)
|
||||
.IsRequired(false);
|
||||
builder.Entity<Tag>()
|
||||
.HasMany(t => t.Games)
|
||||
.WithMany(g => g.Tags);
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.Archives)
|
||||
|
@ -35,10 +42,43 @@ namespace LANCommander.Data
|
|||
.HasMany(g => g.Keys)
|
||||
.WithOne(g => g.Game)
|
||||
.IsRequired(false);
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.Actions)
|
||||
.WithOne(g => g.Game)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.MultiplayerModes)
|
||||
.WithOne(m => m.Game)
|
||||
.IsRequired(true)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.Developers)
|
||||
.WithMany(c => c.DevelopedGames)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"GameDeveloper",
|
||||
g => g.HasOne<Company>().WithMany().HasForeignKey("DeveloperId"),
|
||||
g => g.HasOne<Game>().WithMany().HasForeignKey("GameId")
|
||||
);
|
||||
|
||||
builder.Entity<Game>()
|
||||
.HasMany(g => g.Publishers)
|
||||
.WithMany(c => c.PublishedGames)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"GamePublisher",
|
||||
g => g.HasOne<Company>().WithMany().HasForeignKey("PublisherId"),
|
||||
g => g.HasOne<Game>().WithMany().HasForeignKey("GameId")
|
||||
);
|
||||
}
|
||||
|
||||
public DbSet<Game>? Games { get; set; }
|
||||
|
||||
public DbSet<Genre>? Genres { get; set; }
|
||||
|
||||
public DbSet<Category>? Categories { get; set; }
|
||||
|
||||
public DbSet<Tag>? Tags { get; set; }
|
||||
|
||||
public DbSet<Company>? Companies { get; set; }
|
||||
|
|
9
LANCommander/Data/Enums/MultiplayerType.cs
Normal file
9
LANCommander/Data/Enums/MultiplayerType.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
namespace LANCommander.Data.Enums
|
||||
{
|
||||
public enum MultiplayerType
|
||||
{
|
||||
Local,
|
||||
Lan,
|
||||
Online
|
||||
}
|
||||
}
|
13
LANCommander/Data/Enums/NetworkProtocol.cs
Normal file
13
LANCommander/Data/Enums/NetworkProtocol.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace LANCommander.Data.Enums
|
||||
{
|
||||
public enum NetworkProtocol
|
||||
{
|
||||
[Display(Name = "TCP/IP")]
|
||||
TCPIP,
|
||||
IPX,
|
||||
Modem,
|
||||
Serial
|
||||
}
|
||||
}
|
16
LANCommander/Data/Models/Action.cs
Normal file
16
LANCommander/Data/Models/Action.cs
Normal file
|
@ -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; }
|
||||
}
|
||||
}
|
13
LANCommander/Data/Models/Category.cs
Normal file
13
LANCommander/Data/Models/Category.cs
Normal file
|
@ -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<Category> Children { get; set; }
|
||||
public virtual ICollection<Game> Games { get; set; }
|
||||
}
|
||||
}
|
|
@ -15,11 +15,16 @@ namespace LANCommander.Data.Models
|
|||
[Display(Name = "Released On")]
|
||||
public DateTime ReleasedOn { get; set; }
|
||||
|
||||
public virtual ICollection<Action> Actions { get; set; }
|
||||
|
||||
public bool Singleplayer { get; set; }
|
||||
|
||||
public virtual ICollection<MultiplayerMode> MultiplayerModes { get; set; }
|
||||
public virtual ICollection<Genre> Genres { get; set; }
|
||||
public virtual ICollection<Tag>? Tags { get; set; }
|
||||
|
||||
public virtual Company? Publisher { get; set; }
|
||||
public virtual Company? Developer { get; set; }
|
||||
|
||||
public virtual ICollection<Category>? Categories { get; set; }
|
||||
public virtual ICollection<Company> Publishers { get; set; }
|
||||
public virtual ICollection<Company> Developers { get; set; }
|
||||
public virtual ICollection<Archive>? Archives { get; set; }
|
||||
|
||||
public string? ValidKeyRegex { get; set; }
|
||||
|
|
11
LANCommander/Data/Models/Genre.cs
Normal file
11
LANCommander/Data/Models/Genre.cs
Normal file
|
@ -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<Game> Games { get; set; }
|
||||
}
|
||||
}
|
18
LANCommander/Data/Models/MultiplayerMode.cs
Normal file
18
LANCommander/Data/Models/MultiplayerMode.cs
Normal file
|
@ -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; }
|
||||
}
|
||||
}
|
1018
LANCommander/Migrations/20230109032336_ManifestMigration.Designer.cs
generated
Normal file
1018
LANCommander/Migrations/20230109032336_ManifestMigration.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
415
LANCommander/Migrations/20230109032336_ManifestMigration.cs
Normal file
415
LANCommander/Migrations/20230109032336_ManifestMigration.cs
Normal file
|
@ -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<bool>(
|
||||
name: "Singleplayer",
|
||||
table: "Games",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Actions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Arguments = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Path = table.Column<string>(type: "TEXT", nullable: false),
|
||||
WorkingDirectory = table.Column<string>(type: "TEXT", nullable: false),
|
||||
PrimaryAction = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
GameId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
CreatedOn = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
CreatedById = table.Column<Guid>(type: "TEXT", nullable: true),
|
||||
UpdatedOn = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
UpdatedById = table.Column<Guid>(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<Guid>(type: "TEXT", nullable: false),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||
ParentId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
CreatedOn = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
CreatedById = table.Column<Guid>(type: "TEXT", nullable: true),
|
||||
UpdatedOn = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
UpdatedById = table.Column<Guid>(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<Guid>(type: "TEXT", nullable: false),
|
||||
GameId = table.Column<Guid>(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<Guid>(type: "TEXT", nullable: false),
|
||||
PublisherId = table.Column<Guid>(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<Guid>(type: "TEXT", nullable: false),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||
CreatedOn = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
CreatedById = table.Column<Guid>(type: "TEXT", nullable: true),
|
||||
UpdatedOn = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
UpdatedById = table.Column<Guid>(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<Guid>(type: "TEXT", nullable: false),
|
||||
Type = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
NetworkProtocol = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Description = table.Column<string>(type: "TEXT", nullable: false),
|
||||
MinPlayers = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
MaxPlayers = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Spectators = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
GameId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
CreatedOn = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
CreatedById = table.Column<Guid>(type: "TEXT", nullable: true),
|
||||
UpdatedOn = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
UpdatedById = table.Column<Guid>(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<Guid>(type: "TEXT", nullable: false),
|
||||
GamesId = table.Column<Guid>(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<Guid>(type: "TEXT", nullable: false),
|
||||
GenresId = table.Column<Guid>(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<Guid>(
|
||||
name: "DeveloperId",
|
||||
table: "Games",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,6 +17,66 @@ namespace LANCommander.Migrations
|
|||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "6.0.8");
|
||||
|
||||
modelBuilder.Entity("CategoryGame", b =>
|
||||
{
|
||||
b.Property<Guid>("CategoriesId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("GamesId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("CategoriesId", "GamesId");
|
||||
|
||||
b.HasIndex("GamesId");
|
||||
|
||||
b.ToTable("CategoryGame");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDeveloper", b =>
|
||||
{
|
||||
b.Property<Guid>("DeveloperId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("GameId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("DeveloperId", "GameId");
|
||||
|
||||
b.HasIndex("GameId");
|
||||
|
||||
b.ToTable("GameDeveloper");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameGenre", b =>
|
||||
{
|
||||
b.Property<Guid>("GamesId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("GenresId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("GamesId", "GenresId");
|
||||
|
||||
b.HasIndex("GenresId");
|
||||
|
||||
b.ToTable("GameGenre");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GamePublisher", b =>
|
||||
{
|
||||
b.Property<Guid>("GameId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("PublisherId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("GameId", "PublisherId");
|
||||
|
||||
b.HasIndex("PublisherId");
|
||||
|
||||
b.ToTable("GamePublisher");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameTag", b =>
|
||||
{
|
||||
b.Property<Guid>("GamesId")
|
||||
|
@ -32,6 +92,57 @@ namespace LANCommander.Migrations
|
|||
b.ToTable("GameTag");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LANCommander.Data.Models.Action", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Arguments")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid?>("CreatedById")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("GameId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("PrimaryAction")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<Guid?>("UpdatedById")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("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<Guid>("Id")
|
||||
|
@ -86,6 +197,42 @@ namespace LANCommander.Migrations
|
|||
b.ToTable("Archive");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LANCommander.Data.Models.Category", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid?>("CreatedById")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("ParentId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid?>("UpdatedById")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("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<Guid>("Id")
|
||||
|
@ -133,18 +280,15 @@ namespace LANCommander.Migrations
|
|||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid?>("DeveloperId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("DirectoryName")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid?>("PublisherId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ReleasedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("Singleplayer")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("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<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid?>("CreatedById")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid?>("UpdatedById")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedById");
|
||||
|
||||
b.HasIndex("UpdatedById");
|
||||
|
||||
b.ToTable("Genres");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LANCommander.Data.Models.Key", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
@ -234,6 +405,57 @@ namespace LANCommander.Migrations
|
|||
b.ToTable("Keys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LANCommander.Data.Models.MultiplayerMode", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid?>("CreatedById")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("GameId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("MaxPlayers")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("MinPlayers")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("NetworkProtocol")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Spectators")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<Guid?>("UpdatedById")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("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<Guid>("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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue