using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Nuuru.Server.Migrations.PostgreSQL
{
///
public partial class AddIpBans : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "IpBans",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
IpAddress = table.Column(type: "character varying(45)", maxLength: 45, nullable: false),
Reason = table.Column(type: "text", nullable: true),
StartTime = table.Column(type: "timestamp with time zone", nullable: false),
EndTime = table.Column(type: "timestamp with time zone", nullable: false),
Active = table.Column(type: "boolean", nullable: false),
CreatedById = table.Column(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_IpBans", x => x.Id);
table.ForeignKey(
name: "FK_IpBans_AspNetUsers_CreatedById",
column: x => x.CreatedById,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateIndex(
name: "IX_IpBans_Active_EndTime",
table: "IpBans",
columns: new[] { "Active", "EndTime" });
migrationBuilder.CreateIndex(
name: "IX_IpBans_CreatedById",
table: "IpBans",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_IpBans_IpAddress",
table: "IpBans",
column: "IpAddress");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "IpBans");
}
}
}