Regenerate PostgreSQL migrations

This commit is contained in:
Pat Hartl 2026-06-13 01:36:03 -05:00
parent 5ffabe8064
commit da87e786ff
6 changed files with 1748 additions and 3260 deletions

View file

@ -1,29 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LANCommander.Server.Data.PostgreSQL.Migrations
{
/// <inheritdoc />
public partial class AddMediaSortOrder : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "SortOrder",
table: "Media",
type: "integer",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SortOrder",
table: "Media");
}
}
}

View file

@ -1,99 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LANCommander.Server.Data.PostgreSQL.Migrations
{
/// <inheritdoc />
public partial class AddGameExternalIds : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "GameExternalIds",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
GameId = table.Column<Guid>(type: "uuid", nullable: true),
Provider = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
ExternalId = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
CreatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
CreatedById = table.Column<Guid>(type: "uuid", nullable: true),
UpdatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedById = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_GameExternalIds", x => x.Id);
table.ForeignKey(
name: "FK_GameExternalIds_Games_GameId",
column: x => x.GameId,
principalTable: "Games",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_GameExternalIds_Users_CreatedById",
column: x => x.CreatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_GameExternalIds_Users_UpdatedById",
column: x => x.UpdatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateIndex(
name: "IX_GameExternalIds_CreatedById",
table: "GameExternalIds",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_GameExternalIds_GameId",
table: "GameExternalIds",
column: "GameId");
migrationBuilder.CreateIndex(
name: "IX_GameExternalIds_UpdatedById",
table: "GameExternalIds",
column: "UpdatedById");
// Migrate existing IGDBId data
migrationBuilder.Sql(@"
INSERT INTO ""GameExternalIds"" (""Id"", ""GameId"", ""Provider"", ""ExternalId"", ""CreatedOn"", ""UpdatedOn"")
SELECT gen_random_uuid(), ""Id"", 'IGDB', CAST(""IGDBId"" AS TEXT), ""CreatedOn"", ""UpdatedOn""
FROM ""Games""
WHERE ""IGDBId"" IS NOT NULL
");
migrationBuilder.DropColumn(
name: "IGDBId",
table: "Games");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<long>(
name: "IGDBId",
table: "Games",
type: "bigint",
nullable: true);
// Migrate data back
migrationBuilder.Sql(@"
UPDATE ""Games""
SET ""IGDBId"" = CAST(e.""ExternalId"" AS BIGINT)
FROM ""GameExternalIds"" e
WHERE e.""GameId"" = ""Games"".""Id"" AND e.""Provider"" = 'IGDB'
");
migrationBuilder.DropTable(
name: "GameExternalIds");
}
}
}

View file

@ -92,6 +92,34 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "ChatThreads",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
CreatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
CreatedById = table.Column<Guid>(type: "uuid", nullable: true),
UpdatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedById = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ChatThreads", x => x.Id);
table.ForeignKey(
name: "FK_ChatThreads_Users_CreatedById",
column: x => x.CreatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_ChatThreads_Users_UpdatedById",
column: x => x.UpdatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "Collections",
columns: table => new
@ -125,11 +153,11 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
CreatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
CreatedById = table.Column<Guid>(type: "uuid", nullable: true),
UpdatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedById = table.Column<Guid>(type: "uuid", nullable: true)
UpdatedById = table.Column<Guid>(type: "uuid", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
@ -236,45 +264,6 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Pages",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Title = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
Slug = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
Route = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false),
Contents = table.Column<string>(type: "text", nullable: false),
SortOrder = table.Column<int>(type: "integer", nullable: false),
ParentId = table.Column<Guid>(type: "uuid", nullable: true),
CreatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
CreatedById = table.Column<Guid>(type: "uuid", nullable: true),
UpdatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedById = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Pages", x => x.Id);
table.ForeignKey(
name: "FK_Pages_Pages_ParentId",
column: x => x.ParentId,
principalTable: "Pages",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Pages_Users_CreatedById",
column: x => x.CreatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_Pages_Users_UpdatedById",
column: x => x.UpdatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "Platforms",
columns: table => new
@ -311,6 +300,7 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: true),
Notes = table.Column<string>(type: "text", nullable: true),
OptionSchema = table.Column<string>(type: "text", nullable: true),
CreatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
CreatedById = table.Column<Guid>(type: "uuid", nullable: true),
UpdatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
@ -419,6 +409,36 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "Tools",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", 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: "timestamp with time zone", nullable: false),
CreatedById = table.Column<Guid>(type: "uuid", nullable: true),
UpdatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedById = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Tools", x => x.Id);
table.ForeignKey(
name: "FK_Tools_Users_CreatedById",
column: x => x.CreatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_Tools_Users_UpdatedById",
column: x => x.UpdatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "UserClaims",
columns: table => new
@ -516,12 +536,70 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ChatMessages",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ThreadId = table.Column<Guid>(type: "uuid", nullable: false),
Content = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false),
CreatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
CreatedById = table.Column<Guid>(type: "uuid", nullable: true),
UpdatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedById = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ChatMessages", x => x.Id);
table.ForeignKey(
name: "FK_ChatMessages_ChatThreads_ThreadId",
column: x => x.ThreadId,
principalTable: "ChatThreads",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ChatMessages_Users_CreatedById",
column: x => x.CreatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_ChatMessages_Users_UpdatedById",
column: x => x.UpdatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "ChatThreadUser",
columns: table => new
{
ChatThreadsId = table.Column<Guid>(type: "uuid", nullable: false),
ParticipantsId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ChatThreadUser", x => new { x.ChatThreadsId, x.ParticipantsId });
table.ForeignKey(
name: "FK_ChatThreadUser_ChatThreads_ChatThreadsId",
column: x => x.ChatThreadsId,
principalTable: "ChatThreads",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ChatThreadUser_Users_ParticipantsId",
column: x => x.ParticipantsId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Games",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
IGDBId = table.Column<long>(type: "bigint", nullable: true),
Title = table.Column<string>(type: "text", nullable: false),
SortTitle = table.Column<string>(type: "text", nullable: true),
DirectoryName = table.Column<string>(type: "text", nullable: true),
@ -568,30 +646,6 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "PageRedistributable",
columns: table => new
{
PageId = table.Column<Guid>(type: "uuid", nullable: false),
RedistributableId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PageRedistributable", x => new { x.PageId, x.RedistributableId });
table.ForeignKey(
name: "FK_PageRedistributable_Pages_PageId",
column: x => x.PageId,
principalTable: "Pages",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PageRedistributable_Redistributables_RedistributableId",
column: x => x.RedistributableId,
principalTable: "Redistributables",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "RoleClaims",
columns: table => new
@ -661,6 +715,82 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Pages",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Title = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
Slug = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
Route = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false),
Contents = table.Column<string>(type: "text", nullable: false),
SortOrder = table.Column<int>(type: "integer", nullable: false),
ParentId = table.Column<Guid>(type: "uuid", nullable: true),
ToolId = table.Column<Guid>(type: "uuid", nullable: true),
CreatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
CreatedById = table.Column<Guid>(type: "uuid", nullable: true),
UpdatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedById = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Pages", x => x.Id);
table.ForeignKey(
name: "FK_Pages_Pages_ParentId",
column: x => x.ParentId,
principalTable: "Pages",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Pages_Tools_ToolId",
column: x => x.ToolId,
principalTable: "Tools",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Pages_Users_CreatedById",
column: x => x.CreatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_Pages_Users_UpdatedById",
column: x => x.UpdatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "ChatThreadReadStatuses",
columns: table => new
{
ThreadId = table.Column<Guid>(type: "uuid", nullable: false),
UserId = table.Column<Guid>(type: "uuid", nullable: false),
LastReadMessageId = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ChatThreadReadStatuses", x => new { x.ThreadId, x.UserId });
table.ForeignKey(
name: "FK_ChatThreadReadStatuses_ChatMessages_LastReadMessageId",
column: x => x.LastReadMessageId,
principalTable: "ChatMessages",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_ChatThreadReadStatuses_ChatThreads_ThreadId",
column: x => x.ThreadId,
principalTable: "ChatThreads",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ChatThreadReadStatuses_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Archive",
columns: table => new
@ -672,6 +802,7 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
StorageLocationId = table.Column<Guid>(type: "uuid", nullable: false),
GameId = table.Column<Guid>(type: "uuid", nullable: true),
RedistributableId = table.Column<Guid>(type: "uuid", nullable: true),
ToolId = table.Column<Guid>(type: "uuid", nullable: true),
LastVersionId = table.Column<Guid>(type: "uuid", nullable: true),
UncompressedSize = table.Column<long>(type: "bigint", nullable: false),
CompressedSize = table.Column<long>(type: "bigint", nullable: false),
@ -706,6 +837,12 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
principalTable: "StorageLocations",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Archive_Tools_ToolId",
column: x => x.ToolId,
principalTable: "Tools",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Archive_Users_CreatedById",
column: x => x.CreatedById,
@ -825,6 +962,42 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "GameExternalIds",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
GameId = table.Column<Guid>(type: "uuid", nullable: true),
Provider = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
ExternalId = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
CreatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
CreatedById = table.Column<Guid>(type: "uuid", nullable: true),
UpdatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedById = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_GameExternalIds", x => x.Id);
table.ForeignKey(
name: "FK_GameExternalIds_Games_GameId",
column: x => x.GameId,
principalTable: "Games",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_GameExternalIds_Users_CreatedById",
column: x => x.CreatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_GameExternalIds_Users_UpdatedById",
column: x => x.UpdatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "GameGenre",
columns: table => new
@ -902,7 +1075,8 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
columns: table => new
{
GameId = table.Column<Guid>(type: "uuid", nullable: false),
RedistributableId = table.Column<Guid>(type: "uuid", nullable: false)
RedistributableId = table.Column<Guid>(type: "uuid", nullable: false),
Options = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
@ -994,6 +1168,30 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "GameTool",
columns: table => new
{
GamesId = table.Column<Guid>(type: "uuid", nullable: false),
ToolsId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GameTool", x => new { x.GamesId, x.ToolsId });
table.ForeignKey(
name: "FK_GameTool_Games_GamesId",
column: x => x.GamesId,
principalTable: "Games",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_GameTool_Tools_ToolsId",
column: x => x.ToolsId,
principalTable: "Tools",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Issues",
columns: table => new
@ -1043,7 +1241,7 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
Id = table.Column<Guid>(type: "uuid", nullable: false),
Value = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
GameId = table.Column<Guid>(type: "uuid", nullable: false),
AllocationMethod = table.Column<int>(type: "integer", nullable: false),
AllocationMethod = table.Column<int>(type: "integer", nullable: true),
ClaimedByMacAddress = table.Column<string>(type: "character varying(17)", maxLength: 17, nullable: true),
ClaimedByIpv4Address = table.Column<string>(type: "character varying(15)", maxLength: 15, nullable: true),
ClaimedByComputerName = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
@ -1117,6 +1315,7 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
SourceUrl = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
MimeType = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
Crc32 = table.Column<string>(type: "character varying(8)", maxLength: 8, nullable: false),
SortOrder = table.Column<int>(type: "integer", nullable: false),
ThumbnailId = table.Column<Guid>(type: "uuid", nullable: true),
StorageLocationId = table.Column<Guid>(type: "uuid", nullable: false),
GameId = table.Column<Guid>(type: "uuid", nullable: true),
@ -1207,30 +1406,6 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "PageGame",
columns: table => new
{
GameId = table.Column<Guid>(type: "uuid", nullable: false),
PageId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PageGame", x => new { x.GameId, x.PageId });
table.ForeignKey(
name: "FK_PageGame_Games_GameId",
column: x => x.GameId,
principalTable: "Games",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PageGame_Pages_PageId",
column: x => x.PageId,
principalTable: "Pages",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "PlaySessions",
columns: table => new
@ -1274,6 +1449,42 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Ratings",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
GameId = table.Column<Guid>(type: "uuid", nullable: true),
Source = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
Value = table.Column<float>(type: "real", nullable: false),
CreatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
CreatedById = table.Column<Guid>(type: "uuid", nullable: true),
UpdatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedById = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Ratings", x => x.Id);
table.ForeignKey(
name: "FK_Ratings_Games_GameId",
column: x => x.GameId,
principalTable: "Games",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_Ratings_Users_CreatedById",
column: x => x.CreatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_Ratings_Users_UpdatedById",
column: x => x.UpdatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "SavePaths",
columns: table => new
@ -1318,11 +1529,16 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Engine = table.Column<int>(type: "integer", nullable: false),
Path = table.Column<string>(type: "text", nullable: false),
Arguments = table.Column<string>(type: "text", nullable: false),
WorkingDirectory = table.Column<string>(type: "text", nullable: false),
OnStartScriptPath = table.Column<string>(type: "text", nullable: false),
OnStopScriptPath = table.Column<string>(type: "text", nullable: false),
DockerHostId = table.Column<Guid>(type: "uuid", nullable: true),
RemoteHostId = table.Column<Guid>(type: "uuid", nullable: true),
RemoteServerId = table.Column<Guid>(type: "uuid", nullable: true),
ContainerId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
Host = table.Column<string>(type: "text", nullable: false),
Port = table.Column<int>(type: "integer", nullable: false),
UseShellExecute = table.Column<bool>(type: "boolean", nullable: false),
@ -1359,6 +1575,54 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "PageGame",
columns: table => new
{
GameId = table.Column<Guid>(type: "uuid", nullable: false),
PageId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PageGame", x => new { x.GameId, x.PageId });
table.ForeignKey(
name: "FK_PageGame_Games_GameId",
column: x => x.GameId,
principalTable: "Games",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PageGame_Pages_PageId",
column: x => x.PageId,
principalTable: "Pages",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "PageRedistributable",
columns: table => new
{
PageId = table.Column<Guid>(type: "uuid", nullable: false),
RedistributableId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PageRedistributable", x => new { x.PageId, x.RedistributableId });
table.ForeignKey(
name: "FK_PageRedistributable_Pages_PageId",
column: x => x.PageId,
principalTable: "Pages",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PageRedistributable_Redistributables_RedistributableId",
column: x => x.RedistributableId,
principalTable: "Redistributables",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Actions",
columns: table => new
@ -1370,8 +1634,10 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
WorkingDirectory = table.Column<string>(type: "text", nullable: true),
PrimaryAction = table.Column<bool>(type: "boolean", nullable: false),
SortOrder = table.Column<int>(type: "integer", nullable: false),
OptionOverrides = table.Column<string>(type: "text", nullable: true),
GameId = table.Column<Guid>(type: "uuid", nullable: true),
ServerId = table.Column<Guid>(type: "uuid", nullable: true),
ToolId = table.Column<Guid>(type: "uuid", nullable: true),
CreatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
CreatedById = table.Column<Guid>(type: "uuid", nullable: true),
UpdatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
@ -1392,6 +1658,12 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
principalTable: "Servers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Actions_Tools_ToolId",
column: x => x.ToolId,
principalTable: "Tools",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Actions_Users_CreatedById",
column: x => x.CreatedById,
@ -1442,6 +1714,7 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
RequiresAdmin = table.Column<bool>(type: "boolean", nullable: false),
GameId = table.Column<Guid>(type: "uuid", nullable: true),
RedistributableId = table.Column<Guid>(type: "uuid", nullable: true),
ToolId = table.Column<Guid>(type: "uuid", nullable: true),
ServerId = table.Column<Guid>(type: "uuid", nullable: true),
CreatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
CreatedById = table.Column<Guid>(type: "uuid", nullable: true),
@ -1469,6 +1742,12 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
principalTable: "Servers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Scripts_Tools_ToolId",
column: x => x.ToolId,
principalTable: "Tools",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Scripts_Users_CreatedById",
column: x => x.CreatedById,
@ -1574,6 +1853,11 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
table: "Actions",
column: "ServerId");
migrationBuilder.CreateIndex(
name: "IX_Actions_ToolId",
table: "Actions",
column: "ToolId");
migrationBuilder.CreateIndex(
name: "IX_Actions_UpdatedById",
table: "Actions",
@ -1604,6 +1888,11 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
table: "Archive",
column: "StorageLocationId");
migrationBuilder.CreateIndex(
name: "IX_Archive_ToolId",
table: "Archive",
column: "ToolId");
migrationBuilder.CreateIndex(
name: "IX_Archive_UpdatedById",
table: "Archive",
@ -1629,6 +1918,46 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
table: "CategoryGame",
column: "GamesId");
migrationBuilder.CreateIndex(
name: "IX_ChatMessages_CreatedById",
table: "ChatMessages",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_ChatMessages_ThreadId",
table: "ChatMessages",
column: "ThreadId");
migrationBuilder.CreateIndex(
name: "IX_ChatMessages_UpdatedById",
table: "ChatMessages",
column: "UpdatedById");
migrationBuilder.CreateIndex(
name: "IX_ChatThreadReadStatuses_LastReadMessageId",
table: "ChatThreadReadStatuses",
column: "LastReadMessageId");
migrationBuilder.CreateIndex(
name: "IX_ChatThreadReadStatuses_UserId",
table: "ChatThreadReadStatuses",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_ChatThreads_CreatedById",
table: "ChatThreads",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_ChatThreads_UpdatedById",
table: "ChatThreads",
column: "UpdatedById");
migrationBuilder.CreateIndex(
name: "IX_ChatThreadUser_ParticipantsId",
table: "ChatThreadUser",
column: "ParticipantsId");
migrationBuilder.CreateIndex(
name: "IX_CollectionGame_GameId",
table: "CollectionGame",
@ -1684,6 +2013,21 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
table: "GameDeveloper",
column: "DeveloperId");
migrationBuilder.CreateIndex(
name: "IX_GameExternalIds_CreatedById",
table: "GameExternalIds",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_GameExternalIds_GameId",
table: "GameExternalIds",
column: "GameId");
migrationBuilder.CreateIndex(
name: "IX_GameExternalIds_UpdatedById",
table: "GameExternalIds",
column: "UpdatedById");
migrationBuilder.CreateIndex(
name: "IX_GameGenre_GenresId",
table: "GameGenre",
@ -1754,6 +2098,11 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
table: "GameTag",
column: "TagsId");
migrationBuilder.CreateIndex(
name: "IX_GameTool_ToolsId",
table: "GameTool",
column: "ToolsId");
migrationBuilder.CreateIndex(
name: "IX_Genres_CreatedById",
table: "Genres",
@ -1891,6 +2240,11 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
table: "Pages",
column: "ParentId");
migrationBuilder.CreateIndex(
name: "IX_Pages_ToolId",
table: "Pages",
column: "ToolId");
migrationBuilder.CreateIndex(
name: "IX_Pages_UpdatedById",
table: "Pages",
@ -1931,6 +2285,21 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
table: "PlaySessions",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_Ratings_CreatedById",
table: "Ratings",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_Ratings_GameId",
table: "Ratings",
column: "GameId");
migrationBuilder.CreateIndex(
name: "IX_Ratings_UpdatedById",
table: "Ratings",
column: "UpdatedById");
migrationBuilder.CreateIndex(
name: "IX_Redistributables_CreatedById",
table: "Redistributables",
@ -2002,6 +2371,11 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
table: "Scripts",
column: "ServerId");
migrationBuilder.CreateIndex(
name: "IX_Scripts_ToolId",
table: "Scripts",
column: "ToolId");
migrationBuilder.CreateIndex(
name: "IX_Scripts_UpdatedById",
table: "Scripts",
@ -2072,6 +2446,16 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
table: "Tags",
column: "UpdatedById");
migrationBuilder.CreateIndex(
name: "IX_Tools_CreatedById",
table: "Tools",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_Tools_UpdatedById",
table: "Tools",
column: "UpdatedById");
migrationBuilder.CreateIndex(
name: "IX_UserClaims_UserId",
table: "UserClaims",
@ -2136,6 +2520,12 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
migrationBuilder.DropTable(
name: "CategoryGame");
migrationBuilder.DropTable(
name: "ChatThreadReadStatuses");
migrationBuilder.DropTable(
name: "ChatThreadUser");
migrationBuilder.DropTable(
name: "CollectionGame");
@ -2145,6 +2535,9 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
migrationBuilder.DropTable(
name: "GameDeveloper");
migrationBuilder.DropTable(
name: "GameExternalIds");
migrationBuilder.DropTable(
name: "GameGenre");
@ -2163,6 +2556,9 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
migrationBuilder.DropTable(
name: "GameTag");
migrationBuilder.DropTable(
name: "GameTool");
migrationBuilder.DropTable(
name: "Issues");
@ -2190,6 +2586,9 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
migrationBuilder.DropTable(
name: "PlaySessions");
migrationBuilder.DropTable(
name: "Ratings");
migrationBuilder.DropTable(
name: "RoleClaims");
@ -2226,6 +2625,9 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
migrationBuilder.DropTable(
name: "Categories");
migrationBuilder.DropTable(
name: "ChatMessages");
migrationBuilder.DropTable(
name: "Genres");
@ -2259,6 +2661,12 @@ namespace LANCommander.Server.Data.PostgreSQL.Migrations
migrationBuilder.DropTable(
name: "Roles");
migrationBuilder.DropTable(
name: "ChatThreads");
migrationBuilder.DropTable(
name: "Tools");
migrationBuilder.DropTable(
name: "Games");