YD_WeChatApplet.Api/WeChatApplet/Migrations/20250408085230_20250408v2.cs
2025-06-06 14:57:20 +08:00

142 lines
7.5 KiB
C#

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<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
UserId = table.Column<int>(type: "int", nullable: false, comment: "用户Id"),
GroupName = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "群组名称"),
CreaterId = table.Column<int>(type: "int", nullable: false, comment: "创建人Id"),
CreateTime = table.Column<DateTime>(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<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
UserId = table.Column<int>(type: "int", nullable: false, comment: "用户Id"),
NickName = table.Column<string>(type: "nvarchar(200)", nullable: false, comment: "用户名称"),
HeadImageUrl = table.Column<string>(type: "nvarchar(500)", nullable: true, comment: "头像"),
CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, comment: "创建时间"),
UserGroupId = table.Column<int>(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<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
GroupTaskName = table.Column<string>(type: "nvarchar(200)", nullable: false, comment: "作业名称"),
WorkModeType = table.Column<int>(type: "int", nullable: false, comment: "作业类型"),
WorkModeTypeName = table.Column<string>(type: "nvarchar(200)", nullable: false, comment: "模式类型名称"),
WorkText = table.Column<string>(type: "nvarchar(max)", nullable: false, comment: "作业内容"),
WorkTypeName = table.Column<string>(type: "nvarchar(200)", nullable: false, comment: "作业类型名称"),
Duration = table.Column<int>(type: "int", nullable: false, comment: "作业时长"),
Amount = table.Column<int>(type: "int", nullable: false, comment: "作业数量"),
GroupNumber = table.Column<int>(type: "int", nullable: false, comment: "作业数量"),
IsRepeat = table.Column<bool>(type: "bit", nullable: false, comment: "是否重复"),
RepetitionPeriod = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "重复周期"),
StartTime = table.Column<DateTime>(type: "datetime", nullable: false, comment: "开始时间"),
EndTime = table.Column<DateTime>(type: "datetime", nullable: false, comment: "结束时间"),
CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, comment: "创建时间"),
UserGroupId = table.Column<int>(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<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
UserId = table.Column<int>(type: "int", nullable: false, comment: "用户Id"),
NickName = table.Column<string>(type: "nvarchar(200)", nullable: false, comment: "用户名称"),
HeadImageUrl = table.Column<string>(type: "nvarchar(500)", nullable: true, comment: "头像"),
WorkModeType = table.Column<int>(type: "int", nullable: false, comment: "作业类型"),
WorkModeTypeName = table.Column<string>(type: "nvarchar(200)", nullable: false, comment: "模式类型名称"),
Duration = table.Column<int>(type: "int", nullable: false, comment: "作业时长"),
Amount = table.Column<int>(type: "int", nullable: false, comment: "作业数量"),
CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, comment: "创建时间"),
GroupTaskId = table.Column<int>(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");
}
}
}