using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace MemberCenter.Infrastructure.Persistence.Migrations { public partial class AddEmailBlacklist : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "IsBlacklisted", table: "users", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "BlacklistedAt", table: "users", type: "timestamp with time zone", nullable: true); migrationBuilder.AddColumn( name: "BlacklistedBy", table: "users", type: "text", nullable: true); migrationBuilder.CreateTable( name: "email_blacklist", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Email = table.Column(type: "text", nullable: false), Reason = table.Column(type: "text", nullable: false), BlacklistedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"), BlacklistedBy = table.Column(type: "text", nullable: false) }, constraints: table => { table.PrimaryKey("PK_email_blacklist", x => x.Id); }); migrationBuilder.CreateIndex( name: "IX_email_blacklist_Email", table: "email_blacklist", column: "Email", unique: true); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "email_blacklist"); migrationBuilder.DropColumn( name: "IsBlacklisted", table: "users"); migrationBuilder.DropColumn( name: "BlacklistedAt", table: "users"); migrationBuilder.DropColumn( name: "BlacklistedBy", table: "users"); } } }