415 lines
17 KiB
C#
415 lines
17 KiB
C#
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");
|
|
}
|
|
}
|
|
}
|