20240722112517_altrProjectTeam.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using Microsoft.EntityFrameworkCore.Migrations;
  2. #nullable disable
  3. namespace MTWorkHR.Infrastructure.Migrations
  4. {
  5. /// <inheritdoc />
  6. public partial class altrProjectTeam : Migration
  7. {
  8. /// <inheritdoc />
  9. protected override void Up(MigrationBuilder migrationBuilder)
  10. {
  11. migrationBuilder.DropForeignKey(
  12. name: "FK_ProjectTeam_Projects_TeamId",
  13. table: "ProjectTeam");
  14. migrationBuilder.DropIndex(
  15. name: "IX_ProjectTeam_TeamId",
  16. table: "ProjectTeam");
  17. migrationBuilder.DropColumn(
  18. name: "AssignedUserId",
  19. table: "ProjectTeam");
  20. migrationBuilder.RenameColumn(
  21. name: "AssignedUserName",
  22. table: "ProjectTeam",
  23. newName: "TeamName");
  24. migrationBuilder.AlterColumn<long>(
  25. name: "TeamId",
  26. table: "ProjectTeam",
  27. type: "bigint",
  28. nullable: false,
  29. defaultValue: 0L,
  30. oldClrType: typeof(long),
  31. oldType: "bigint",
  32. oldNullable: true);
  33. migrationBuilder.CreateIndex(
  34. name: "IX_ProjectTeam_ProjectId",
  35. table: "ProjectTeam",
  36. column: "ProjectId");
  37. migrationBuilder.AddForeignKey(
  38. name: "FK_ProjectTeam_Projects_ProjectId",
  39. table: "ProjectTeam",
  40. column: "ProjectId",
  41. principalTable: "Projects",
  42. principalColumn: "Id",
  43. onDelete: ReferentialAction.Cascade);
  44. }
  45. /// <inheritdoc />
  46. protected override void Down(MigrationBuilder migrationBuilder)
  47. {
  48. migrationBuilder.DropForeignKey(
  49. name: "FK_ProjectTeam_Projects_ProjectId",
  50. table: "ProjectTeam");
  51. migrationBuilder.DropIndex(
  52. name: "IX_ProjectTeam_ProjectId",
  53. table: "ProjectTeam");
  54. migrationBuilder.RenameColumn(
  55. name: "TeamName",
  56. table: "ProjectTeam",
  57. newName: "AssignedUserName");
  58. migrationBuilder.AlterColumn<long>(
  59. name: "TeamId",
  60. table: "ProjectTeam",
  61. type: "bigint",
  62. nullable: true,
  63. oldClrType: typeof(long),
  64. oldType: "bigint");
  65. migrationBuilder.AddColumn<string>(
  66. name: "AssignedUserId",
  67. table: "ProjectTeam",
  68. type: "nvarchar(max)",
  69. nullable: false,
  70. defaultValue: "");
  71. migrationBuilder.CreateIndex(
  72. name: "IX_ProjectTeam_TeamId",
  73. table: "ProjectTeam",
  74. column: "TeamId");
  75. migrationBuilder.AddForeignKey(
  76. name: "FK_ProjectTeam_Projects_TeamId",
  77. table: "ProjectTeam",
  78. column: "TeamId",
  79. principalTable: "Projects",
  80. principalColumn: "Id");
  81. }
  82. }
  83. }