using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Rmsys.Infrastructure.Migrations
{
///
public partial class Init : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "appointdocs",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
MeetingId = table.Column(type: "int", nullable: false),
DeptId = table.Column(type: "int", nullable: true),
DocNo = table.Column(type: "varchar(64)", maxLength: 64, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Title = table.Column(type: "varchar(255)", maxLength: 255, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Persons = table.Column(type: "int", nullable: false),
Pages = table.Column(type: "int", nullable: false),
FileSize = table.Column(type: "bigint", nullable: false),
FilePath = table.Column(type: "varchar(500)", maxLength: 500, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Version = table.Column(type: "varchar(16)", maxLength: 16, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
UploadedBy = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
UploadedAt = table.Column(type: "datetime(6)", nullable: true),
Status = table.Column(type: "varchar(16)", maxLength: 16, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
IsDeleted = table.Column(type: "int", nullable: false),
CreatedAt = table.Column(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_appointdocs", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "auditlogs",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
At = table.Column(type: "datetime(6)", nullable: false),
UserId = table.Column(type: "int", nullable: true),
UserName = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Role = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Action = table.Column(type: "varchar(32)", maxLength: 32, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Target = table.Column(type: "varchar(255)", maxLength: 255, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Detail = table.Column(type: "varchar(1000)", maxLength: 1000, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Ip = table.Column(type: "varchar(64)", maxLength: 64, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Device = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Success = table.Column(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_auditlogs", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "cadrerelations",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CadreId = table.Column(type: "int", nullable: false),
RelatedName = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Relation = table.Column(type: "varchar(16)", maxLength: 16, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
RelatedPost = table.Column(type: "varchar(255)", maxLength: 255, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
NeedAvoid = table.Column(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_cadrerelations", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "datapackages",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
MeetingId = table.Column(type: "int", nullable: false),
PkgNo = table.Column(type: "varchar(32)", maxLength: 32, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Encrypt = table.Column(type: "varchar(16)", maxLength: 16, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
PwdHash = table.Column(type: "varchar(128)", maxLength: 128, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
ExpireAt = table.Column(type: "datetime(6)", nullable: true),
ClearPolicy = table.Column(type: "varchar(16)", maxLength: 16, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Watermark = table.Column(type: "varchar(128)", maxLength: 128, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
FontLevel = table.Column(type: "varchar(8)", maxLength: 8, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
AllowFontChange = table.Column(type: "int", nullable: false),
SwitchesJson = table.Column(type: "varchar(1000)", maxLength: 1000, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Status = table.Column(type: "varchar(16)", maxLength: 16, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
FileSize = table.Column(type: "bigint", nullable: false),
FilePath = table.Column(type: "varchar(500)", maxLength: 500, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedBy = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedAt = table.Column(type: "datetime(6)", nullable: false),
DownloadedAt = table.Column(type: "datetime(6)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_datapackages", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "depts",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Code = table.Column(type: "varchar(32)", maxLength: 32, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Duty = table.Column(type: "varchar(255)", maxLength: 255, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Leader = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Sort = table.Column(type: "int", nullable: false),
Enabled = table.Column(type: "int", nullable: false),
CreatedAt = table.Column(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_depts", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "dictitems",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Type = table.Column(type: "varchar(32)", maxLength: 32, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Code = table.Column(type: "varchar(32)", maxLength: 32, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Label = table.Column(type: "varchar(64)", maxLength: 64, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Sort = table.Column(type: "int", nullable: false),
Enabled = table.Column(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_dictitems", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "materials",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
MeetingId = table.Column(type: "int", nullable: false),
DeptId = table.Column(type: "int", nullable: true),
CadreId = table.Column(type: "int", nullable: true),
Type = table.Column(type: "varchar(16)", maxLength: 16, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Title = table.Column(type: "varchar(255)", maxLength: 255, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
FileName = table.Column(type: "varchar(255)", maxLength: 255, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
FilePath = table.Column(type: "varchar(500)", maxLength: 500, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
FileSize = table.Column(type: "bigint", nullable: false),
Pages = table.Column(type: "int", nullable: false),
Version = table.Column(type: "varchar(16)", maxLength: 16, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
UploadedBy = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
UploadedAt = table.Column(type: "datetime(6)", nullable: true),
Status = table.Column(type: "varchar(16)", maxLength: 16, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Seq = table.Column(type: "int", nullable: false),
CreatedAt = table.Column(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_materials", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "meetings",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Type = table.Column(type: "varchar(16)", maxLength: 16, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
SessionNo = table.Column(type: "int", nullable: true),
Name = table.Column(type: "varchar(128)", maxLength: 128, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
HeldAt = table.Column(type: "datetime(6)", nullable: true),
Place = table.Column(type: "varchar(128)", maxLength: 128, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Host = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Secret = table.Column(type: "varchar(16)", maxLength: 16, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
SecretStars = table.Column(type: "varchar(8)", maxLength: 8, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
PwdLevel = table.Column(type: "varchar(16)", maxLength: 16, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Status = table.Column(type: "varchar(16)", maxLength: 16, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Remark = table.Column(type: "varchar(500)", maxLength: 500, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
BatchNo = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedAt = table.Column(type: "datetime(6)", nullable: false),
UpdatedAt = table.Column(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_meetings", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "packagedevices",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
PackageId = table.Column(type: "int", nullable: false),
PadId = table.Column(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_packagedevices", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "packageitems",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
PackageId = table.Column(type: "int", nullable: false),
MaterialType = table.Column(type: "varchar(16)", maxLength: 16, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Enabled = table.Column(type: "int", nullable: false),
Sort = table.Column(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_packageitems", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "paddevices",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
PadNo = table.Column(type: "varchar(32)", maxLength: 32, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Model = table.Column(type: "varchar(64)", maxLength: 64, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
OwnerDeptId = table.Column(type: "int", nullable: true),
Status = table.Column(type: "int", nullable: false),
LastSeenAt = table.Column(type: "datetime(6)", nullable: true),
CreatedAt = table.Column(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_paddevices", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "pwdhistories",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
UserId = table.Column(type: "int", nullable: false),
PwdHash = table.Column(type: "varchar(128)", maxLength: 128, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ChangedAt = table.Column(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_pwdhistories", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "sysroles",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Code = table.Column(type: "varchar(32)", maxLength: 32, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Name = table.Column(type: "varchar(32)", maxLength: 32, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Perms = table.Column(type: "varchar(1000)", maxLength: 1000, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Sort = table.Column(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_sysroles", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "sysuserroles",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
UserId = table.Column(type: "int", nullable: false),
RoleId = table.Column(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_sysuserroles", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "sysusers",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Account = table.Column(type: "varchar(32)", maxLength: 32, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
RealName = table.Column(type: "varchar(32)", maxLength: 32, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
DeptId = table.Column(type: "int", nullable: true),
Phone = table.Column(type: "varchar(20)", maxLength: 20, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
PwdHash = table.Column(type: "varchar(128)", maxLength: 128, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
PwdSalt = table.Column(type: "varchar(64)", maxLength: 64, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
PwdUpdatedAt = table.Column(type: "datetime(6)", nullable: true),
LastLoginAt = table.Column(type: "datetime(6)", nullable: true),
FailCount = table.Column(type: "int", nullable: false),
LockedUntil = table.Column(type: "datetime(6)", nullable: true),
Enabled = table.Column(type: "int", nullable: false),
CreatedAt = table.Column(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_sysusers", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "cadres",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
DeptId = table.Column(type: "int", nullable: true),
Name = table.Column(type: "varchar(32)", maxLength: 32, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Sex = table.Column(type: "varchar(4)", maxLength: 4, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Birth = table.Column(type: "varchar(16)", maxLength: 16, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Nation = table.Column(type: "varchar(16)", maxLength: 16, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
NativePlace = table.Column(type: "varchar(64)", maxLength: 64, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
BirthPlace = table.Column(type: "varchar(64)", maxLength: 64, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
PartyDate = table.Column(type: "varchar(16)", maxLength: 16, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
WorkDate = table.Column(type: "varchar(16)", maxLength: 16, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Health = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
TechPost = table.Column(type: "varchar(64)", maxLength: 64, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Expertise = table.Column(type: "varchar(255)", maxLength: 255, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
EduFullSchool = table.Column(type: "varchar(128)", maxLength: 128, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
EduFullMajor = table.Column(type: "varchar(128)", maxLength: 128, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
EduFullLevel = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
EduFullDegree = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
EduInSchool = table.Column(type: "varchar(128)", maxLength: 128, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
EduInMajor = table.Column(type: "varchar(128)", maxLength: 128, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
EduInLevel = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
EduInDegree = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
CurrentPost = table.Column(type: "varchar(255)", maxLength: 255, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
ProposedPost = table.Column(type: "varchar(255)", maxLength: 255, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
DismissPost = table.Column(type: "varchar(255)", maxLength: 255, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Rewards = table.Column(type: "varchar(1000)", maxLength: 1000, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Exams = table.Column(type: "varchar(255)", maxLength: 255, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
AppointReason = table.Column(type: "varchar(1000)", maxLength: 1000, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
PhotoPath = table.Column(type: "varchar(255)", maxLength: 255, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedAt = table.Column(type: "datetime(6)", nullable: false),
UpdatedAt = table.Column(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_cadres", x => x.Id);
table.ForeignKey(
name: "FK_cadres_depts_DeptId",
column: x => x.DeptId,
principalTable: "depts",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "cadrefamilies",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CadreId = table.Column(type: "int", nullable: false),
Sort = table.Column(type: "int", nullable: false),
Relation = table.Column(type: "varchar(16)", maxLength: 16, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Name = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Age = table.Column(type: "varchar(8)", maxLength: 8, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Political = table.Column(type: "varchar(16)", maxLength: 16, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
WorkUnit = table.Column(type: "varchar(255)", maxLength: 255, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_cadrefamilies", x => x.Id);
table.ForeignKey(
name: "FK_cadrefamilies_cadres_CadreId",
column: x => x.CadreId,
principalTable: "cadres",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "cadrenotes",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CadreId = table.Column(type: "int", nullable: false),
MeetingId = table.Column(type: "int", nullable: true),
FieldName = table.Column(type: "varchar(64)", maxLength: 64, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Content = table.Column(type: "varchar(1000)", maxLength: 1000, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Source = table.Column(type: "varchar(16)", maxLength: 16, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Author = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedAt = table.Column(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_cadrenotes", x => x.Id);
table.ForeignKey(
name: "FK_cadrenotes_cadres_CadreId",
column: x => x.CadreId,
principalTable: "cadres",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "cadreresumes",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CadreId = table.Column(type: "int", nullable: false),
Sort = table.Column(type: "int", nullable: false),
Period = table.Column(type: "varchar(64)", maxLength: 64, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Content = table.Column(type: "varchar(500)", maxLength: 500, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_cadreresumes", x => x.Id);
table.ForeignKey(
name: "FK_cadreresumes_cadres_CadreId",
column: x => x.CadreId,
principalTable: "cadres",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "meetingcadres",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
MeetingId = table.Column(type: "int", nullable: false),
CadreId = table.Column(type: "int", nullable: false),
IssueNo = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
SortNo = table.Column(type: "int", nullable: false),
Result = table.Column(type: "varchar(16)", maxLength: 16, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Vote = table.Column(type: "varchar(16)", maxLength: 16, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
DecidedAt = table.Column(type: "datetime(6)", nullable: true),
Remark = table.Column(type: "varchar(500)", maxLength: 500, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_meetingcadres", x => x.Id);
table.ForeignKey(
name: "FK_meetingcadres_cadres_CadreId",
column: x => x.CadreId,
principalTable: "cadres",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_meetingcadres_meetings_MeetingId",
column: x => x.MeetingId,
principalTable: "meetings",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_appointdocs_MeetingId_DeptId",
table: "appointdocs",
columns: new[] { "MeetingId", "DeptId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_auditlogs_Action_At",
table: "auditlogs",
columns: new[] { "Action", "At" });
migrationBuilder.CreateIndex(
name: "IX_auditlogs_At",
table: "auditlogs",
column: "At");
migrationBuilder.CreateIndex(
name: "IX_auditlogs_UserName_At",
table: "auditlogs",
columns: new[] { "UserName", "At" });
migrationBuilder.CreateIndex(
name: "IX_cadrefamilies_CadreId_Sort",
table: "cadrefamilies",
columns: new[] { "CadreId", "Sort" });
migrationBuilder.CreateIndex(
name: "IX_cadrenotes_CadreId_MeetingId",
table: "cadrenotes",
columns: new[] { "CadreId", "MeetingId" });
migrationBuilder.CreateIndex(
name: "IX_cadrerelations_CadreId",
table: "cadrerelations",
column: "CadreId");
migrationBuilder.CreateIndex(
name: "IX_cadreresumes_CadreId_Sort",
table: "cadreresumes",
columns: new[] { "CadreId", "Sort" });
migrationBuilder.CreateIndex(
name: "IX_cadres_DeptId_Name",
table: "cadres",
columns: new[] { "DeptId", "Name" });
migrationBuilder.CreateIndex(
name: "IX_datapackages_MeetingId",
table: "datapackages",
column: "MeetingId");
migrationBuilder.CreateIndex(
name: "IX_datapackages_PkgNo",
table: "datapackages",
column: "PkgNo",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_depts_Code",
table: "depts",
column: "Code",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_dictitems_Type_Code",
table: "dictitems",
columns: new[] { "Type", "Code" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_materials_MeetingId_DeptId",
table: "materials",
columns: new[] { "MeetingId", "DeptId" });
migrationBuilder.CreateIndex(
name: "IX_materials_MeetingId_Type_CadreId",
table: "materials",
columns: new[] { "MeetingId", "Type", "CadreId" });
migrationBuilder.CreateIndex(
name: "IX_meetingcadres_CadreId",
table: "meetingcadres",
column: "CadreId");
migrationBuilder.CreateIndex(
name: "IX_meetingcadres_MeetingId_CadreId",
table: "meetingcadres",
columns: new[] { "MeetingId", "CadreId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_meetingcadres_MeetingId_SortNo",
table: "meetingcadres",
columns: new[] { "MeetingId", "SortNo" });
migrationBuilder.CreateIndex(
name: "IX_meetings_BatchNo",
table: "meetings",
column: "BatchNo");
migrationBuilder.CreateIndex(
name: "IX_meetings_Type_SessionNo",
table: "meetings",
columns: new[] { "Type", "SessionNo" });
migrationBuilder.CreateIndex(
name: "IX_packagedevices_PackageId_PadId",
table: "packagedevices",
columns: new[] { "PackageId", "PadId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_packageitems_PackageId_MaterialType",
table: "packageitems",
columns: new[] { "PackageId", "MaterialType" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_paddevices_PadNo",
table: "paddevices",
column: "PadNo",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_pwdhistories_UserId_ChangedAt",
table: "pwdhistories",
columns: new[] { "UserId", "ChangedAt" });
migrationBuilder.CreateIndex(
name: "IX_sysroles_Code",
table: "sysroles",
column: "Code",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_sysuserroles_UserId_RoleId",
table: "sysuserroles",
columns: new[] { "UserId", "RoleId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_sysusers_Account",
table: "sysusers",
column: "Account",
unique: true);
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "appointdocs");
migrationBuilder.DropTable(
name: "auditlogs");
migrationBuilder.DropTable(
name: "cadrefamilies");
migrationBuilder.DropTable(
name: "cadrenotes");
migrationBuilder.DropTable(
name: "cadrerelations");
migrationBuilder.DropTable(
name: "cadreresumes");
migrationBuilder.DropTable(
name: "datapackages");
migrationBuilder.DropTable(
name: "dictitems");
migrationBuilder.DropTable(
name: "materials");
migrationBuilder.DropTable(
name: "meetingcadres");
migrationBuilder.DropTable(
name: "packagedevices");
migrationBuilder.DropTable(
name: "packageitems");
migrationBuilder.DropTable(
name: "paddevices");
migrationBuilder.DropTable(
name: "pwdhistories");
migrationBuilder.DropTable(
name: "sysroles");
migrationBuilder.DropTable(
name: "sysuserroles");
migrationBuilder.DropTable(
name: "sysusers");
migrationBuilder.DropTable(
name: "cadres");
migrationBuilder.DropTable(
name: "meetings");
migrationBuilder.DropTable(
name: "depts");
}
}
}