using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Nuuru.Server.Migrations.PostgreSQL
{
///
public partial class AddIpBanAppeals : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "AppealsDenied",
table: "IpBans",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.CreateTable(
name: "IpBanAppeals",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
IpBanId = table.Column(type: "uuid", nullable: false),
UserId = table.Column(type: "uuid", nullable: true),
IpAddress = table.Column(type: "character varying(45)", maxLength: 45, nullable: false),
Reason = table.Column(type: "character varying(4000)", maxLength: 4000, nullable: false),
Status = table.Column(type: "integer", nullable: false),
CreatedAt = table.Column(type: "timestamp with time zone", nullable: false),
ResolvedAt = table.Column(type: "timestamp with time zone", nullable: true),
ModeratorNote = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true),
ModeratorId = table.Column(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_IpBanAppeals", x => x.Id);
table.ForeignKey(
name: "FK_IpBanAppeals_AspNetUsers_ModeratorId",
column: x => x.ModeratorId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_IpBanAppeals_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_IpBanAppeals_IpBans_IpBanId",
column: x => x.IpBanId,
principalTable: "IpBans",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_IpBanAppeals_IpAddress",
table: "IpBanAppeals",
column: "IpAddress");
migrationBuilder.CreateIndex(
name: "IX_IpBanAppeals_IpBanId",
table: "IpBanAppeals",
column: "IpBanId");
migrationBuilder.CreateIndex(
name: "IX_IpBanAppeals_ModeratorId",
table: "IpBanAppeals",
column: "ModeratorId");
migrationBuilder.CreateIndex(
name: "IX_IpBanAppeals_Status",
table: "IpBanAppeals",
column: "Status");
migrationBuilder.CreateIndex(
name: "IX_IpBanAppeals_UserId",
table: "IpBanAppeals",
column: "UserId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "IpBanAppeals");
migrationBuilder.DropColumn(
name: "AppealsDenied",
table: "IpBans");
}
}
}