using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ColaFlow.Modules.Identity.Infrastructure.Persistence.Migrations
{
///
public partial class AddEmailRateLimitsTable : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "email_rate_limits",
schema: "identity",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
email = table.Column(type: "character varying(255)", maxLength: 255, nullable: false),
tenant_id = table.Column(type: "uuid", nullable: false),
operation_type = table.Column(type: "character varying(50)", maxLength: 50, nullable: false),
last_sent_at = table.Column(type: "timestamp with time zone", nullable: false),
attempts_count = table.Column(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_email_rate_limits", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "ix_email_rate_limits_email_tenant_operation",
schema: "identity",
table: "email_rate_limits",
columns: new[] { "email", "tenant_id", "operation_type" },
unique: true);
migrationBuilder.CreateIndex(
name: "ix_email_rate_limits_last_sent_at",
schema: "identity",
table: "email_rate_limits",
column: "last_sent_at");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "email_rate_limits",
schema: "identity");
}
}
}