20211130023258_addObjectStaffStatistics.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using Microsoft.EntityFrameworkCore.Migrations;
  2. namespace wispro.sp.api.Migrations
  3. {
  4. public partial class addObjectStaffStatistics : Migration
  5. {
  6. protected override void Up(MigrationBuilder migrationBuilder)
  7. {
  8. migrationBuilder.CreateTable(
  9. name: "StaffStatistics",
  10. columns: table => new
  11. {
  12. Id = table.Column<int>(type: "int", nullable: false)
  13. .Annotation("SqlServer:Identity", "1, 1"),
  14. CalMonthId = table.Column<int>(type: "int", nullable: false),
  15. StaffId = table.Column<int>(type: "int", nullable: false),
  16. jxType = table.Column<string>(type: "nvarchar(max)", nullable: true),
  17. totalBasePoint = table.Column<double>(type: "float", nullable: true),
  18. totalActuallyPoint = table.Column<double>(type: "float", nullable: true)
  19. },
  20. constraints: table =>
  21. {
  22. table.PrimaryKey("PK_StaffStatistics", x => x.Id);
  23. table.ForeignKey(
  24. name: "FK_StaffStatistics_CalMonth_CalMonthId",
  25. column: x => x.CalMonthId,
  26. principalTable: "CalMonth",
  27. principalColumn: "Id",
  28. onDelete: ReferentialAction.Cascade);
  29. table.ForeignKey(
  30. name: "FK_StaffStatistics_Staff_StaffId",
  31. column: x => x.StaffId,
  32. principalTable: "Staff",
  33. principalColumn: "Id",
  34. onDelete: ReferentialAction.Cascade);
  35. });
  36. migrationBuilder.CreateIndex(
  37. name: "IX_StaffStatistics_CalMonthId",
  38. table: "StaffStatistics",
  39. column: "CalMonthId");
  40. migrationBuilder.CreateIndex(
  41. name: "IX_StaffStatistics_StaffId",
  42. table: "StaffStatistics",
  43. column: "StaffId");
  44. }
  45. protected override void Down(MigrationBuilder migrationBuilder)
  46. {
  47. migrationBuilder.DropTable(
  48. name: "StaffStatistics");
  49. }
  50. }
  51. }