using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Moonlight.App.Database.Migrations { /// public partial class RemovedOldLogsAndAddedErrorLog : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AuditLog"); migrationBuilder.DropTable( name: "ErrorLog"); migrationBuilder.DropTable( name: "SecurityLog"); migrationBuilder.CreateTable( name: "SecurityLogs", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Text = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), CreatedAt = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SecurityLogs", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "SecurityLogs"); migrationBuilder.CreateTable( name: "AuditLog", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), CreatedAt = table.Column(type: "datetime(6)", nullable: false), Ip = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), JsonData = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), System = table.Column(type: "tinyint(1)", nullable: false), Type = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_AuditLog", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "ErrorLog", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Class = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), CreatedAt = table.Column(type: "datetime(6)", nullable: false), Ip = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), JsonData = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Stacktrace = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), System = table.Column(type: "tinyint(1)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ErrorLog", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "SecurityLog", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), CreatedAt = table.Column(type: "datetime(6)", nullable: false), Ip = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), JsonData = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), System = table.Column(type: "tinyint(1)", nullable: false), Type = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SecurityLog", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); } } }