20240730144541_altrTaskHistory2.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using Microsoft.EntityFrameworkCore.Migrations;
  2. #nullable disable
  3. namespace MTWorkHR.Infrastructure.Migrations
  4. {
  5. /// <inheritdoc />
  6. public partial class altrTaskHistory2 : Migration
  7. {
  8. /// <inheritdoc />
  9. protected override void Up(MigrationBuilder migrationBuilder)
  10. {
  11. migrationBuilder.DropForeignKey(
  12. name: "FK_UserTaskHistories_UserTasks_UserTaskId",
  13. table: "UserTaskHistories");
  14. migrationBuilder.DropIndex(
  15. name: "IX_UserTaskHistories_UserTaskId",
  16. table: "UserTaskHistories");
  17. migrationBuilder.DropColumn(
  18. name: "UserTaskId",
  19. table: "UserTaskHistories");
  20. migrationBuilder.CreateIndex(
  21. name: "IX_UserTaskHistories_TaskId",
  22. table: "UserTaskHistories",
  23. column: "TaskId");
  24. migrationBuilder.AddForeignKey(
  25. name: "FK_UserTaskHistories_UserTasks_TaskId",
  26. table: "UserTaskHistories",
  27. column: "TaskId",
  28. principalTable: "UserTasks",
  29. principalColumn: "Id",
  30. onDelete: ReferentialAction.NoAction);
  31. }
  32. /// <inheritdoc />
  33. protected override void Down(MigrationBuilder migrationBuilder)
  34. {
  35. migrationBuilder.DropForeignKey(
  36. name: "FK_UserTaskHistories_UserTasks_TaskId",
  37. table: "UserTaskHistories");
  38. migrationBuilder.DropIndex(
  39. name: "IX_UserTaskHistories_TaskId",
  40. table: "UserTaskHistories");
  41. migrationBuilder.AddColumn<long>(
  42. name: "UserTaskId",
  43. table: "UserTaskHistories",
  44. type: "bigint",
  45. nullable: true);
  46. migrationBuilder.CreateIndex(
  47. name: "IX_UserTaskHistories_UserTaskId",
  48. table: "UserTaskHistories",
  49. column: "UserTaskId");
  50. migrationBuilder.AddForeignKey(
  51. name: "FK_UserTaskHistories_UserTasks_UserTaskId",
  52. table: "UserTaskHistories",
  53. column: "UserTaskId",
  54. principalTable: "UserTasks",
  55. principalColumn: "Id");
  56. }
  57. }
  58. }