using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Nuuru.Server.Migrations { /// public partial class AddIpBanAppeals : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "AppealsDenied", table: "IpBans", type: "INTEGER", nullable: false, defaultValue: false); migrationBuilder.CreateTable( name: "IpBanAppeals", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), IpBanId = table.Column(type: "TEXT", nullable: false), UserId = table.Column(type: "TEXT", nullable: true), IpAddress = table.Column(type: "TEXT", maxLength: 45, nullable: false), Reason = table.Column(type: "TEXT", maxLength: 4000, nullable: false), Status = table.Column(type: "INTEGER", nullable: false), CreatedAt = table.Column(type: "TEXT", nullable: false), ResolvedAt = table.Column(type: "TEXT", nullable: true), ModeratorNote = table.Column(type: "TEXT", maxLength: 2000, nullable: true), ModeratorId = table.Column(type: "TEXT", 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"); } } }