using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace LY.MicroService.TaskManagement.Migrations { public partial class AddModuleTaskManagement : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterDatabase() .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "TK_BackgroundJobLogs", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), JobId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), JobName = table.Column(type: "varchar(100)", maxLength: 100, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), JobGroup = table.Column(type: "varchar(50)", maxLength: 50, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), JobType = table.Column(type: "varchar(200)", maxLength: 200, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Message = table.Column(type: "varchar(1000)", maxLength: 1000, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), RunTime = table.Column(type: "datetime(6)", nullable: false), Exception = table.Column(type: "varchar(2000)", maxLength: 2000, nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => { table.PrimaryKey("PK_TK_BackgroundJobLogs", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "TK_BackgroundJobs", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Name = table.Column(type: "varchar(100)", maxLength: 100, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Group = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Type = table.Column(type: "varchar(200)", maxLength: 200, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Args = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Status = table.Column(type: "int", nullable: false), IsEnabled = table.Column(type: "tinyint(1)", nullable: false), Description = table.Column(type: "varchar(255)", maxLength: 255, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), LockTimeOut = table.Column(type: "int", nullable: false), BeginTime = table.Column(type: "datetime(6)", nullable: false), EndTime = table.Column(type: "datetime(6)", nullable: true), LastRunTime = table.Column(type: "datetime(6)", nullable: true), NextRunTime = table.Column(type: "datetime(6)", nullable: true), JobType = table.Column(type: "int", nullable: false), Cron = table.Column(type: "varchar(50)", maxLength: 50, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Priority = table.Column(type: "int", nullable: false), TriggerCount = table.Column(type: "int", nullable: false), TryCount = table.Column(type: "int", nullable: false), MaxTryCount = table.Column(type: "int", nullable: false), MaxCount = table.Column(type: "int", nullable: false), Interval = table.Column(type: "int", nullable: false), IsAbandoned = table.Column(type: "tinyint(1)", nullable: false), ExtraProperties = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ConcurrencyStamp = table.Column(type: "varchar(40)", maxLength: 40, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), CreationTime = table.Column(type: "datetime(6)", nullable: false), CreatorId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), LastModificationTime = table.Column(type: "datetime(6)", nullable: true), LastModifierId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_TK_BackgroundJobs", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_TK_BackgroundJobLogs_JobGroup_JobName", table: "TK_BackgroundJobLogs", columns: new[] { "JobGroup", "JobName" }); migrationBuilder.CreateIndex( name: "IX_TK_BackgroundJobs_Name_Group", table: "TK_BackgroundJobs", columns: new[] { "Name", "Group" }); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "TK_BackgroundJobLogs"); migrationBuilder.DropTable( name: "TK_BackgroundJobs"); } } }