Added missing relations to server db model. Started with server crud. Removed unused relations from detail responses

This commit is contained in:
2024-12-17 22:52:09 +01:00
parent 747712c5c4
commit a34a3ba8b4
20 changed files with 1131 additions and 40 deletions

View File

@@ -0,0 +1,55 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MoonlightServers.ApiServer.Database.Migrations
{
/// <inheritdoc />
public partial class AddedServerRelations : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ServerId",
schema: "Servers",
table: "ServerBackups",
type: "int",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_ServerBackups_ServerId",
schema: "Servers",
table: "ServerBackups",
column: "ServerId");
migrationBuilder.AddForeignKey(
name: "FK_ServerBackups_Servers_ServerId",
schema: "Servers",
table: "ServerBackups",
column: "ServerId",
principalSchema: "Servers",
principalTable: "Servers",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ServerBackups_Servers_ServerId",
schema: "Servers",
table: "ServerBackups");
migrationBuilder.DropIndex(
name: "IX_ServerBackups_ServerId",
schema: "Servers",
table: "ServerBackups");
migrationBuilder.DropColumn(
name: "ServerId",
schema: "Servers",
table: "ServerBackups");
}
}
}