LANCommander/LANCommander.Launcher.Data/Migrations/20240522012114_InitialSeed.cs
Pat Hartl 9ba9887eb1 Rename project files, namespaces, artifacts
Client has been renamed to launcher, and thus namespaces and artifact names had to change. The server project has also had some artifacts renamed in order to create a more clear separation of builds. This will break auto-updates before v0.9.0.
2024-08-04 17:53:19 -05:00

493 lines
21 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LANCommander.Launcher.Data.Migrations
{
/// <inheritdoc />
public partial class InitialSeed : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
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),
UpdatedOn = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Categories", x => x.Id);
table.ForeignKey(
name: "FK_Categories_Categories_ParentId",
column: x => x.ParentId,
principalTable: "Categories",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Collections",
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),
UpdatedOn = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Collections", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Companies",
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),
UpdatedOn = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Companies", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Engines",
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),
UpdatedOn = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Engines", x => x.Id);
});
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),
UpdatedOn = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Genres", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Redistributables",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: true),
Notes = table.Column<string>(type: "TEXT", nullable: true),
CreatedOn = table.Column<DateTime>(type: "TEXT", nullable: false),
UpdatedOn = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Redistributables", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Tags",
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),
UpdatedOn = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Tags", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Games",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
IGDBId = table.Column<long>(type: "INTEGER", nullable: true),
Title = table.Column<string>(type: "TEXT", nullable: false),
SortTitle = table.Column<string>(type: "TEXT", nullable: true),
Description = table.Column<string>(type: "TEXT", nullable: true),
Notes = table.Column<string>(type: "TEXT", nullable: true),
Installed = table.Column<bool>(type: "INTEGER", nullable: false),
InstalledVersion = table.Column<string>(type: "TEXT", nullable: true),
InstallDirectory = table.Column<string>(type: "TEXT", nullable: true),
ReleasedOn = table.Column<DateTime>(type: "TEXT", nullable: true),
Type = table.Column<int>(type: "INTEGER", nullable: false),
BaseGameId = table.Column<Guid>(type: "TEXT", nullable: true),
Singleplayer = table.Column<bool>(type: "INTEGER", nullable: false),
EngineId = table.Column<Guid>(type: "TEXT", nullable: true),
CreatedOn = table.Column<DateTime>(type: "TEXT", nullable: false),
UpdatedOn = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Games", x => x.Id);
table.ForeignKey(
name: "FK_Games_Engines_EngineId",
column: x => x.EngineId,
principalTable: "Engines",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_Games_Games_BaseGameId",
column: x => x.BaseGameId,
principalTable: "Games",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
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: "CollectionGame",
columns: table => new
{
CollectionId = table.Column<Guid>(type: "TEXT", nullable: false),
GameId = table.Column<Guid>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CollectionGame", x => new { x.CollectionId, x.GameId });
table.ForeignKey(
name: "FK_CollectionGame_Collections_CollectionId",
column: x => x.CollectionId,
principalTable: "Collections",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CollectionGame_Games_GameId",
column: x => x.GameId,
principalTable: "Games",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
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: "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.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: "GameRedistributable",
columns: table => new
{
GameId = table.Column<Guid>(type: "TEXT", nullable: false),
RedistributableId = table.Column<Guid>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GameRedistributable", x => new { x.GameId, x.RedistributableId });
table.ForeignKey(
name: "FK_GameRedistributable_Games_GameId",
column: x => x.GameId,
principalTable: "Games",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_GameRedistributable_Redistributables_RedistributableId",
column: x => x.RedistributableId,
principalTable: "Redistributables",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "GameTag",
columns: table => new
{
GamesId = table.Column<Guid>(type: "TEXT", nullable: false),
TagsId = table.Column<Guid>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GameTag", x => new { x.GamesId, x.TagsId });
table.ForeignKey(
name: "FK_GameTag_Games_GamesId",
column: x => x.GamesId,
principalTable: "Games",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_GameTag_Tags_TagsId",
column: x => x.TagsId,
principalTable: "Tags",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Media",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
FileId = table.Column<Guid>(type: "TEXT", nullable: false),
Type = table.Column<int>(type: "INTEGER", nullable: false),
SourceUrl = table.Column<string>(type: "TEXT", maxLength: 2048, nullable: true),
MimeType = table.Column<string>(type: "TEXT", maxLength: 255, nullable: true),
Crc32 = table.Column<string>(type: "TEXT", maxLength: 8, nullable: false),
GameId = table.Column<Guid>(type: "TEXT", nullable: true),
CreatedOn = table.Column<DateTime>(type: "TEXT", nullable: false),
UpdatedOn = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Media", x => x.Id);
table.ForeignKey(
name: "FK_Media_Games_GameId",
column: x => x.GameId,
principalTable: "Games",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
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: true),
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),
UpdatedOn = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_MultiplayerModes", x => x.Id);
table.ForeignKey(
name: "FK_MultiplayerModes_Games_GameId",
column: x => x.GameId,
principalTable: "Games",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Categories_ParentId",
table: "Categories",
column: "ParentId");
migrationBuilder.CreateIndex(
name: "IX_CategoryGame_GamesId",
table: "CategoryGame",
column: "GamesId");
migrationBuilder.CreateIndex(
name: "IX_CollectionGame_GameId",
table: "CollectionGame",
column: "GameId");
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_GameRedistributable_RedistributableId",
table: "GameRedistributable",
column: "RedistributableId");
migrationBuilder.CreateIndex(
name: "IX_Games_BaseGameId",
table: "Games",
column: "BaseGameId");
migrationBuilder.CreateIndex(
name: "IX_Games_EngineId",
table: "Games",
column: "EngineId");
migrationBuilder.CreateIndex(
name: "IX_GameTag_TagsId",
table: "GameTag",
column: "TagsId");
migrationBuilder.CreateIndex(
name: "IX_Media_GameId",
table: "Media",
column: "GameId");
migrationBuilder.CreateIndex(
name: "IX_MultiplayerModes_GameId",
table: "MultiplayerModes",
column: "GameId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CategoryGame");
migrationBuilder.DropTable(
name: "CollectionGame");
migrationBuilder.DropTable(
name: "GameDeveloper");
migrationBuilder.DropTable(
name: "GameGenre");
migrationBuilder.DropTable(
name: "GamePublisher");
migrationBuilder.DropTable(
name: "GameRedistributable");
migrationBuilder.DropTable(
name: "GameTag");
migrationBuilder.DropTable(
name: "Media");
migrationBuilder.DropTable(
name: "MultiplayerModes");
migrationBuilder.DropTable(
name: "Categories");
migrationBuilder.DropTable(
name: "Collections");
migrationBuilder.DropTable(
name: "Genres");
migrationBuilder.DropTable(
name: "Companies");
migrationBuilder.DropTable(
name: "Redistributables");
migrationBuilder.DropTable(
name: "Tags");
migrationBuilder.DropTable(
name: "Games");
migrationBuilder.DropTable(
name: "Engines");
}
}
}