using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace MP.TaskMan.Migrations { public partial class InitTaskMan : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "TaskList", columns: table => new { TaskId = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Ordinal = table.Column(type: "int", nullable: false), Name = table.Column(type: "nvarchar(max)", nullable: true), Descript = table.Column(type: "nvarchar(max)", nullable: true), TType = table.Column(type: "int", nullable: false), Command = table.Column(type: "nvarchar(max)", nullable: true), Args = table.Column(type: "nvarchar(max)", nullable: true), Freq = table.Column(type: "int", nullable: false), Cad = table.Column(type: "int", nullable: false), DtLastExec = table.Column(type: "datetime2", nullable: false), DtNextExec = table.Column(type: "datetime2", nullable: false), LastDuration = table.Column(type: "float", nullable: false), LastIsError = table.Column(type: "bit", nullable: false), LastResult = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_TaskList", x => x.TaskId); }); migrationBuilder.CreateTable( name: "TaskExec", columns: table => new { TaskExecId = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), TaskId = table.Column(type: "int", nullable: false), DtStart = table.Column(type: "datetime2", nullable: false), DtEnd = table.Column(type: "datetime2", nullable: false), IsError = table.Column(type: "bit", nullable: false), Result = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_TaskExec", x => x.TaskExecId); table.ForeignKey( name: "FK_TaskExec_TaskList_TaskId", column: x => x.TaskId, principalTable: "TaskList", principalColumn: "TaskId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_TaskExec_TaskId", table: "TaskExec", column: "TaskId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "TaskExec"); migrationBuilder.DropTable( name: "TaskList"); } } }