//
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace Database.Migrations
{
///
public partial class Add_CustomEventCategory : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "CustomEventCategoryId",
schema: "dbo",
table: "CustomEvents",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.CreateTable(
name: "CustomEventCategory",
schema: "dbo",
columns: table => new
{
Id = table.Column(type: "uniqueidentifier", nullable: false),
AllianceId = table.Column(type: "uniqueidentifier", nullable: false),
Name = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: false),
IsPointsEvent = table.Column(type: "bit", nullable: false),
IsParticipationEvent = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomEventCategory", x => x.Id);
table.ForeignKey(
name: "FK_CustomEventCategory_Alliances_AllianceId",
column: x => x.AllianceId,
principalSchema: "dbo",
principalTable: "Alliances",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_CustomEvents_CustomEventCategoryId",
schema: "dbo",
table: "CustomEvents",
column: "CustomEventCategoryId");
migrationBuilder.CreateIndex(
name: "IX_CustomEventCategory_AllianceId",
schema: "dbo",
table: "CustomEventCategory",
column: "AllianceId");
migrationBuilder.AddForeignKey(
name: "FK_CustomEvents_CustomEventCategory_CustomEventCategoryId",
schema: "dbo",
table: "CustomEvents",
column: "CustomEventCategoryId",
principalSchema: "dbo",
principalTable: "CustomEventCategory",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_CustomEvents_CustomEventCategory_CustomEventCategoryId",
schema: "dbo",
table: "CustomEvents");
migrationBuilder.DropTable(
name: "CustomEventCategory",
schema: "dbo");
migrationBuilder.DropIndex(
name: "IX_CustomEvents_CustomEventCategoryId",
schema: "dbo",
table: "CustomEvents");
migrationBuilder.DropColumn(
name: "CustomEventCategoryId",
schema: "dbo",
table: "CustomEvents");
}
}
}