LANCommander/LANCommander/Migrations/20231104224712_AddServerHttpPaths.cs
Pat Hartl 4fb11c1dd7 Change server HTTP options to allow multiple specified paths.
This is useful if you only want to share specific paths via HTTP, or have the paths stored in multiple places and want to unite them under one URL structure.
2023-11-04 19:43:38 -05:00

82 lines
3.3 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LANCommander.Migrations
{
/// <inheritdoc />
public partial class AddServerHttpPaths : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ServerHttpPath",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
LocalPath = table.Column<string>(type: "TEXT", nullable: false),
Path = table.Column<string>(type: "TEXT", nullable: false),
ServerId = table.Column<Guid>(type: "TEXT", nullable: false),
ServerId1 = table.Column<Guid>(type: "TEXT", nullable: true),
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_ServerHttpPath", x => x.Id);
table.ForeignKey(
name: "FK_ServerHttpPath_AspNetUsers_CreatedById",
column: x => x.CreatedById,
principalTable: "AspNetUsers",
principalColumn: "Id");
table.ForeignKey(
name: "FK_ServerHttpPath_AspNetUsers_UpdatedById",
column: x => x.UpdatedById,
principalTable: "AspNetUsers",
principalColumn: "Id");
table.ForeignKey(
name: "FK_ServerHttpPath_Servers_ServerId",
column: x => x.ServerId,
principalTable: "Servers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ServerHttpPath_Servers_ServerId1",
column: x => x.ServerId1,
principalTable: "Servers",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_ServerHttpPath_CreatedById",
table: "ServerHttpPath",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_ServerHttpPath_ServerId",
table: "ServerHttpPath",
column: "ServerId");
migrationBuilder.CreateIndex(
name: "IX_ServerHttpPath_ServerId1",
table: "ServerHttpPath",
column: "ServerId1");
migrationBuilder.CreateIndex(
name: "IX_ServerHttpPath_UpdatedById",
table: "ServerHttpPath",
column: "UpdatedById");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ServerHttpPath");
}
}
}