159 lines
6.4 KiB
C#
159 lines
6.4 KiB
C#
|
|
using System;
|
|||
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|
|||
|
|
#nullable disable
|
|||
|
|
|
|||
|
|
namespace LANCommander.Migrations
|
|||
|
|
{
|
|||
|
|
/// <inheritdoc />
|
|||
|
|
public partial class AddPages : Migration
|
|||
|
|
{
|
|||
|
|
/// <inheritdoc />
|
|||
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
|
{
|
|||
|
|
migrationBuilder.CreateTable(
|
|||
|
|
name: "Pages",
|
|||
|
|
columns: table => new
|
|||
|
|
{
|
|||
|
|
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
|||
|
|
Title = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false),
|
|||
|
|
Route = table.Column<string>(type: "TEXT", maxLength: 2048, nullable: false),
|
|||
|
|
Contents = 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_Pages", x => x.Id);
|
|||
|
|
table.ForeignKey(
|
|||
|
|
name: "FK_Pages_AspNetUsers_CreatedById",
|
|||
|
|
column: x => x.CreatedById,
|
|||
|
|
principalTable: "AspNetUsers",
|
|||
|
|
principalColumn: "Id",
|
|||
|
|
onDelete: ReferentialAction.SetNull);
|
|||
|
|
table.ForeignKey(
|
|||
|
|
name: "FK_Pages_AspNetUsers_UpdatedById",
|
|||
|
|
column: x => x.UpdatedById,
|
|||
|
|
principalTable: "AspNetUsers",
|
|||
|
|
principalColumn: "Id",
|
|||
|
|
onDelete: ReferentialAction.SetNull);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateTable(
|
|||
|
|
name: "PageGame",
|
|||
|
|
columns: table => new
|
|||
|
|
{
|
|||
|
|
GameId = table.Column<Guid>(type: "TEXT", nullable: false),
|
|||
|
|
PageId = table.Column<Guid>(type: "TEXT", 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: "TEXT", nullable: false),
|
|||
|
|
RedistributableId = table.Column<Guid>(type: "TEXT", 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: "PageServer",
|
|||
|
|
columns: table => new
|
|||
|
|
{
|
|||
|
|
PageId = table.Column<Guid>(type: "TEXT", nullable: false),
|
|||
|
|
ServerId = table.Column<Guid>(type: "TEXT", nullable: false)
|
|||
|
|
},
|
|||
|
|
constraints: table =>
|
|||
|
|
{
|
|||
|
|
table.PrimaryKey("PK_PageServer", x => new { x.PageId, x.ServerId });
|
|||
|
|
table.ForeignKey(
|
|||
|
|
name: "FK_PageServer_Pages_PageId",
|
|||
|
|
column: x => x.PageId,
|
|||
|
|
principalTable: "Pages",
|
|||
|
|
principalColumn: "Id",
|
|||
|
|
onDelete: ReferentialAction.Cascade);
|
|||
|
|
table.ForeignKey(
|
|||
|
|
name: "FK_PageServer_Servers_ServerId",
|
|||
|
|
column: x => x.ServerId,
|
|||
|
|
principalTable: "Servers",
|
|||
|
|
principalColumn: "Id",
|
|||
|
|
onDelete: ReferentialAction.Cascade);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateIndex(
|
|||
|
|
name: "IX_PageGame_PageId",
|
|||
|
|
table: "PageGame",
|
|||
|
|
column: "PageId");
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateIndex(
|
|||
|
|
name: "IX_PageRedistributable_RedistributableId",
|
|||
|
|
table: "PageRedistributable",
|
|||
|
|
column: "RedistributableId");
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateIndex(
|
|||
|
|
name: "IX_Pages_CreatedById",
|
|||
|
|
table: "Pages",
|
|||
|
|
column: "CreatedById");
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateIndex(
|
|||
|
|
name: "IX_Pages_UpdatedById",
|
|||
|
|
table: "Pages",
|
|||
|
|
column: "UpdatedById");
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateIndex(
|
|||
|
|
name: "IX_PageServer_ServerId",
|
|||
|
|
table: "PageServer",
|
|||
|
|
column: "ServerId");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <inheritdoc />
|
|||
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
|
{
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "PageGame");
|
|||
|
|
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "PageRedistributable");
|
|||
|
|
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "PageServer");
|
|||
|
|
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "Pages");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|