|
@@ -3,11 +3,40 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
|
|
namespace wispro.sp.api.Migrations
|
|
|
{
|
|
|
- public partial class spDB0910 : Migration
|
|
|
+ public partial class CalMonth : Migration
|
|
|
{
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
{
|
|
|
migrationBuilder.CreateTable(
|
|
|
+ name: "BasePointRules",
|
|
|
+ columns: table => new
|
|
|
+ {
|
|
|
+ Id = table.Column<int>(type: "int", nullable: false)
|
|
|
+ .Annotation("SqlServer:Identity", "1, 1"),
|
|
|
+ Rule = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
|
+ Point = table.Column<double>(type: "float", nullable: false)
|
|
|
+ },
|
|
|
+ constraints: table =>
|
|
|
+ {
|
|
|
+ table.PrimaryKey("PK_BasePointRules", x => x.Id);
|
|
|
+ });
|
|
|
+
|
|
|
+ migrationBuilder.CreateTable(
|
|
|
+ name: "CalMonth",
|
|
|
+ columns: table => new
|
|
|
+ {
|
|
|
+ Id = table.Column<int>(type: "int", nullable: false)
|
|
|
+ .Annotation("SqlServer:Identity", "1, 1"),
|
|
|
+ year = table.Column<int>(type: "int", nullable: false),
|
|
|
+ month = table.Column<int>(type: "int", nullable: false),
|
|
|
+ status = table.Column<int>(type: "int", nullable: false)
|
|
|
+ },
|
|
|
+ constraints: table =>
|
|
|
+ {
|
|
|
+ table.PrimaryKey("PK_CalMonth", x => x.Id);
|
|
|
+ });
|
|
|
+
|
|
|
+ migrationBuilder.CreateTable(
|
|
|
name: "StaffGrade",
|
|
|
columns: table => new
|
|
|
{
|
|
@@ -25,7 +54,8 @@ namespace wispro.sp.api.Migrations
|
|
|
name: "Staff",
|
|
|
columns: table => new
|
|
|
{
|
|
|
- Id = table.Column<int>(type: "int", nullable: false),
|
|
|
+ Id = table.Column<int>(type: "int", nullable: false)
|
|
|
+ .Annotation("SqlServer:Identity", "1, 1"),
|
|
|
Account = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
|
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
|
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
|
@@ -35,6 +65,7 @@ namespace wispro.sp.api.Migrations
|
|
|
Department = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
|
|
WorkPlace = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
|
|
EntyDate = table.Column<DateTime>(type: "date", nullable: true),
|
|
|
+ Mail = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
|
Memo = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
|
|
},
|
|
|
constraints: table =>
|
|
@@ -74,10 +105,31 @@ namespace wispro.sp.api.Migrations
|
|
|
});
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
+ name: "AttachFile",
|
|
|
+ columns: table => new
|
|
|
+ {
|
|
|
+ Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
|
+ Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
|
|
|
+ SavePath = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
|
|
|
+ UploadUserId = table.Column<int>(type: "int", nullable: false)
|
|
|
+ },
|
|
|
+ constraints: table =>
|
|
|
+ {
|
|
|
+ table.PrimaryKey("PK_AttachFile", x => x.Id);
|
|
|
+ table.ForeignKey(
|
|
|
+ name: "FK_AttachFile_UpdateUser",
|
|
|
+ column: x => x.UploadUserId,
|
|
|
+ principalTable: "Staff",
|
|
|
+ principalColumn: "Id",
|
|
|
+ onDelete: ReferentialAction.Cascade);
|
|
|
+ });
|
|
|
+
|
|
|
+ migrationBuilder.CreateTable(
|
|
|
name: "Customer",
|
|
|
columns: table => new
|
|
|
{
|
|
|
- Id = table.Column<int>(type: "int", nullable: false),
|
|
|
+ Id = table.Column<int>(type: "int", nullable: false)
|
|
|
+ .Annotation("SqlServer:Identity", "1, 1"),
|
|
|
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
|
|
|
ContactMan = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
|
|
Address = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
|
|
@@ -96,6 +148,26 @@ namespace wispro.sp.api.Migrations
|
|
|
});
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
+ name: "Message",
|
|
|
+ columns: table => new
|
|
|
+ {
|
|
|
+ Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
|
+ MessageInfo = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
|
|
|
+ Type = table.Column<int>(type: "int", nullable: false),
|
|
|
+ FromId = table.Column<int>(type: "int", nullable: false)
|
|
|
+ },
|
|
|
+ constraints: table =>
|
|
|
+ {
|
|
|
+ table.PrimaryKey("PK_Message", x => x.Id);
|
|
|
+ table.ForeignKey(
|
|
|
+ name: "FK_From_Staff",
|
|
|
+ column: x => x.FromId,
|
|
|
+ principalTable: "Staff",
|
|
|
+ principalColumn: "Id",
|
|
|
+ onDelete: ReferentialAction.Restrict);
|
|
|
+ });
|
|
|
+
|
|
|
+ migrationBuilder.CreateTable(
|
|
|
name: "PerformanceItem",
|
|
|
columns: table => new
|
|
|
{
|
|
@@ -129,13 +201,21 @@ namespace wispro.sp.api.Migrations
|
|
|
FirstDraftDate = table.Column<DateTime>(type: "date", nullable: true),
|
|
|
OverDueMemo = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
|
|
|
BasePoint = table.Column<decimal>(type: "numeric(18,2)", nullable: true),
|
|
|
- status = table.Column<int>(type: "int", nullable: true),
|
|
|
+ Status = table.Column<int>(type: "int", nullable: true),
|
|
|
+ CaseMemo = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
|
+ CalMonthId = table.Column<int>(type: "int", nullable: false),
|
|
|
StaffId = table.Column<int>(type: "int", nullable: true)
|
|
|
},
|
|
|
constraints: table =>
|
|
|
{
|
|
|
table.PrimaryKey("PK_PerformanceItem", x => x.Id);
|
|
|
table.ForeignKey(
|
|
|
+ name: "FK_PerformanceItem_CalMonth",
|
|
|
+ column: x => x.CalMonthId,
|
|
|
+ principalTable: "CalMonth",
|
|
|
+ principalColumn: "Id",
|
|
|
+ onDelete: ReferentialAction.Cascade);
|
|
|
+ table.ForeignKey(
|
|
|
name: "FK_PerformanceItem_Customer",
|
|
|
column: x => x.CustomerId,
|
|
|
principalTable: "Customer",
|
|
@@ -162,6 +242,38 @@ namespace wispro.sp.api.Migrations
|
|
|
});
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
+ name: "MessageReadRecord",
|
|
|
+ columns: table => new
|
|
|
+ {
|
|
|
+ MessageId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
|
+ StaffId = table.Column<int>(type: "int", nullable: false),
|
|
|
+ isReaded = table.Column<bool>(type: "bit", nullable: false),
|
|
|
+ MessageId1 = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
|
|
|
+ },
|
|
|
+ constraints: table =>
|
|
|
+ {
|
|
|
+ table.PrimaryKey("PK_MessageReadRecord", x => new { x.MessageId, x.StaffId });
|
|
|
+ table.ForeignKey(
|
|
|
+ name: "FK_MessageReadRecord_Message",
|
|
|
+ column: x => x.MessageId,
|
|
|
+ principalTable: "Message",
|
|
|
+ principalColumn: "Id",
|
|
|
+ onDelete: ReferentialAction.Restrict);
|
|
|
+ table.ForeignKey(
|
|
|
+ name: "FK_MessageReadRecord_Message_MessageId1",
|
|
|
+ column: x => x.MessageId1,
|
|
|
+ principalTable: "Message",
|
|
|
+ principalColumn: "Id",
|
|
|
+ onDelete: ReferentialAction.Restrict);
|
|
|
+ table.ForeignKey(
|
|
|
+ name: "FK_MessageReadRecord_Staff",
|
|
|
+ column: x => x.StaffId,
|
|
|
+ principalTable: "Staff",
|
|
|
+ principalColumn: "Id",
|
|
|
+ onDelete: ReferentialAction.Restrict);
|
|
|
+ });
|
|
|
+
|
|
|
+ migrationBuilder.CreateTable(
|
|
|
name: "ItemStaff",
|
|
|
columns: table => new
|
|
|
{
|
|
@@ -186,6 +298,30 @@ namespace wispro.sp.api.Migrations
|
|
|
onDelete: ReferentialAction.Restrict);
|
|
|
});
|
|
|
|
|
|
+ migrationBuilder.CreateTable(
|
|
|
+ name: "MessagePerformanceItems",
|
|
|
+ columns: table => new
|
|
|
+ {
|
|
|
+ MessageId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
|
+ ItemId = table.Column<int>(type: "int", nullable: false)
|
|
|
+ },
|
|
|
+ constraints: table =>
|
|
|
+ {
|
|
|
+ table.PrimaryKey("PK_MessagePerformanceItems", x => new { x.ItemId, x.MessageId });
|
|
|
+ table.ForeignKey(
|
|
|
+ name: "FK_MessagePerformanceItem_Item",
|
|
|
+ column: x => x.ItemId,
|
|
|
+ principalTable: "PerformanceItem",
|
|
|
+ principalColumn: "Id",
|
|
|
+ onDelete: ReferentialAction.Cascade);
|
|
|
+ table.ForeignKey(
|
|
|
+ name: "FK_MessagePerformanceItem_Message",
|
|
|
+ column: x => x.MessageId,
|
|
|
+ principalTable: "Message",
|
|
|
+ principalColumn: "Id",
|
|
|
+ onDelete: ReferentialAction.Cascade);
|
|
|
+ });
|
|
|
+
|
|
|
migrationBuilder.InsertData(
|
|
|
table: "StaffGrade",
|
|
|
columns: new[] { "Id", "Coefficient", "Grade" },
|
|
@@ -241,6 +377,11 @@ namespace wispro.sp.api.Migrations
|
|
|
});
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
+ name: "IX_AttachFile_UploadUserId",
|
|
|
+ table: "AttachFile",
|
|
|
+ column: "UploadUserId");
|
|
|
+
|
|
|
+ migrationBuilder.CreateIndex(
|
|
|
name: "IX_Customer_ResponseManId",
|
|
|
table: "Customer",
|
|
|
column: "ResponseManId");
|
|
@@ -251,6 +392,31 @@ namespace wispro.sp.api.Migrations
|
|
|
column: "DoPersonId");
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
+ name: "IX_Message_FromId",
|
|
|
+ table: "Message",
|
|
|
+ column: "FromId");
|
|
|
+
|
|
|
+ migrationBuilder.CreateIndex(
|
|
|
+ name: "IX_MessagePerformanceItems_MessageId",
|
|
|
+ table: "MessagePerformanceItems",
|
|
|
+ column: "MessageId");
|
|
|
+
|
|
|
+ migrationBuilder.CreateIndex(
|
|
|
+ name: "IX_MessageReadRecord_MessageId1",
|
|
|
+ table: "MessageReadRecord",
|
|
|
+ column: "MessageId1");
|
|
|
+
|
|
|
+ migrationBuilder.CreateIndex(
|
|
|
+ name: "IX_MessageReadRecord_StaffId",
|
|
|
+ table: "MessageReadRecord",
|
|
|
+ column: "StaffId");
|
|
|
+
|
|
|
+ migrationBuilder.CreateIndex(
|
|
|
+ name: "IX_PerformanceItem_CalMonthId",
|
|
|
+ table: "PerformanceItem",
|
|
|
+ column: "CalMonthId");
|
|
|
+
|
|
|
+ migrationBuilder.CreateIndex(
|
|
|
name: "IX_PerformanceItem_CustomerId",
|
|
|
table: "PerformanceItem",
|
|
|
column: "CustomerId");
|
|
@@ -284,15 +450,33 @@ namespace wispro.sp.api.Migrations
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
|
{
|
|
|
migrationBuilder.DropTable(
|
|
|
+ name: "AttachFile");
|
|
|
+
|
|
|
+ migrationBuilder.DropTable(
|
|
|
+ name: "BasePointRules");
|
|
|
+
|
|
|
+ migrationBuilder.DropTable(
|
|
|
name: "ItemStaff");
|
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
+ name: "MessagePerformanceItems");
|
|
|
+
|
|
|
+ migrationBuilder.DropTable(
|
|
|
+ name: "MessageReadRecord");
|
|
|
+
|
|
|
+ migrationBuilder.DropTable(
|
|
|
name: "VerifyCoefficient");
|
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
name: "PerformanceItem");
|
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
+ name: "Message");
|
|
|
+
|
|
|
+ migrationBuilder.DropTable(
|
|
|
+ name: "CalMonth");
|
|
|
+
|
|
|
+ migrationBuilder.DropTable(
|
|
|
name: "Customer");
|
|
|
|
|
|
migrationBuilder.DropTable(
|