using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace SlpModularCms.Modules.Contact.Migrations { /// public partial class InitialCreate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterDatabase() .Annotation("MySQL:Charset", "utf8mb4"); migrationBuilder.CreateTable( name: "ContactIdempotency", columns: table => new { SiteId = table.Column(type: "varchar(100)", maxLength: 100, nullable: false), Key = table.Column(type: "char(36)", nullable: false), CreatedAt = table.Column(type: "datetime", nullable: false), StatusCode = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ContactIdempotency", x => new { x.SiteId, x.Key }); }) .Annotation("MySQL:Charset", "utf8mb4"); migrationBuilder.CreateTable( name: "ContactMessages", columns: table => new { Id = table.Column(type: "char(36)", nullable: false), SiteId = table.Column(type: "varchar(100)", maxLength: 100, nullable: false), ReceivedAt = table.Column(type: "datetime", nullable: false), Name = table.Column(type: "varchar(100)", maxLength: 100, nullable: false), Email = table.Column(type: "varchar(254)", maxLength: 254, nullable: false), Subject = table.Column(type: "varchar(100)", maxLength: 100, nullable: false), Message = table.Column(type: "varchar(2000)", maxLength: 2000, nullable: false), Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false), MailStatus = table.Column(type: "varchar(20)", maxLength: 20, nullable: false), MailError = table.Column(type: "varchar(100)", maxLength: 100, nullable: true), MailAttempts = table.Column(type: "int", nullable: false), NextMailAttemptAt = table.Column(type: "datetime", nullable: true), RetentionUntil = table.Column(type: "datetime", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ContactMessages", x => x.Id); }) .Annotation("MySQL:Charset", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_ContactIdempotency_CreatedAt", table: "ContactIdempotency", column: "CreatedAt"); migrationBuilder.CreateIndex( name: "IX_ContactMessages_RetentionUntil", table: "ContactMessages", column: "RetentionUntil"); migrationBuilder.CreateIndex( name: "IX_ContactMessages_SiteId_Status_ReceivedAt", table: "ContactMessages", columns: new[] { "SiteId", "Status", "ReceivedAt" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ContactIdempotency"); migrationBuilder.DropTable( name: "ContactMessages"); } } }