using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace YD_WeChatApplet.Api.Migrations { public partial class _20250408v2 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "WCA_UserGroup", columns: table => new { Id = table.Column(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), UserId = table.Column(type: "int", nullable: false, comment: "用户Id"), GroupName = table.Column(type: "nvarchar(100)", nullable: false, comment: "群组名称"), CreaterId = table.Column(type: "int", nullable: false, comment: "创建人Id"), CreateTime = table.Column(type: "datetime", nullable: false, comment: "创建时间") }, constraints: table => { table.PrimaryKey("PK_WCA_UserGroup", x => x.Id); }); migrationBuilder.CreateTable( name: "WCA_GroupMembers", columns: table => new { Id = table.Column(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), UserId = table.Column(type: "int", nullable: false, comment: "用户Id"), NickName = table.Column(type: "nvarchar(200)", nullable: false, comment: "用户名称"), HeadImageUrl = table.Column(type: "nvarchar(500)", nullable: true, comment: "头像"), CreateTime = table.Column(type: "datetime", nullable: false, comment: "创建时间"), UserGroupId = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_WCA_GroupMembers", x => x.Id); table.ForeignKey( name: "FK_WCA_GroupMembers_WCA_UserGroup_UserGroupId", column: x => x.UserGroupId, principalTable: "WCA_UserGroup", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "WCA_GroupTask", columns: table => new { Id = table.Column(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), GroupTaskName = table.Column(type: "nvarchar(200)", nullable: false, comment: "作业名称"), WorkModeType = table.Column(type: "int", nullable: false, comment: "作业类型"), WorkModeTypeName = table.Column(type: "nvarchar(200)", nullable: false, comment: "模式类型名称"), WorkText = table.Column(type: "nvarchar(max)", nullable: false, comment: "作业内容"), WorkTypeName = table.Column(type: "nvarchar(200)", nullable: false, comment: "作业类型名称"), Duration = table.Column(type: "int", nullable: false, comment: "作业时长"), Amount = table.Column(type: "int", nullable: false, comment: "作业数量"), GroupNumber = table.Column(type: "int", nullable: false, comment: "作业数量"), IsRepeat = table.Column(type: "bit", nullable: false, comment: "是否重复"), RepetitionPeriod = table.Column(type: "nvarchar(100)", nullable: false, comment: "重复周期"), StartTime = table.Column(type: "datetime", nullable: false, comment: "开始时间"), EndTime = table.Column(type: "datetime", nullable: false, comment: "结束时间"), CreateTime = table.Column(type: "datetime", nullable: false, comment: "创建时间"), UserGroupId = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_WCA_GroupTask", x => x.Id); table.ForeignKey( name: "FK_WCA_GroupTask_WCA_UserGroup_UserGroupId", column: x => x.UserGroupId, principalTable: "WCA_UserGroup", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "WCA_GroupTaskResult", columns: table => new { Id = table.Column(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), UserId = table.Column(type: "int", nullable: false, comment: "用户Id"), NickName = table.Column(type: "nvarchar(200)", nullable: false, comment: "用户名称"), HeadImageUrl = table.Column(type: "nvarchar(500)", nullable: true, comment: "头像"), WorkModeType = table.Column(type: "int", nullable: false, comment: "作业类型"), WorkModeTypeName = table.Column(type: "nvarchar(200)", nullable: false, comment: "模式类型名称"), Duration = table.Column(type: "int", nullable: false, comment: "作业时长"), Amount = table.Column(type: "int", nullable: false, comment: "作业数量"), CreateTime = table.Column(type: "datetime", nullable: false, comment: "创建时间"), GroupTaskId = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_WCA_GroupTaskResult", x => x.Id); table.ForeignKey( name: "FK_WCA_GroupTaskResult_WCA_GroupTask_GroupTaskId", column: x => x.GroupTaskId, principalTable: "WCA_GroupTask", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_WCA_GroupMembers_UserGroupId", table: "WCA_GroupMembers", column: "UserGroupId"); migrationBuilder.CreateIndex( name: "IX_WCA_GroupTask_UserGroupId", table: "WCA_GroupTask", column: "UserGroupId"); migrationBuilder.CreateIndex( name: "IX_WCA_GroupTaskResult_GroupTaskId", table: "WCA_GroupTaskResult", column: "GroupTaskId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "WCA_GroupMembers"); migrationBuilder.DropTable( name: "WCA_GroupTaskResult"); migrationBuilder.DropTable( name: "WCA_GroupTask"); migrationBuilder.DropTable( name: "WCA_UserGroup"); } } }