20240718135952_altrProjectTeams.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace MTWorkHR.Infrastructure.Migrations
  5. {
  6. /// <inheritdoc />
  7. public partial class altrProjectTeams : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.AddColumn<string>(
  13. name: "Desc",
  14. table: "Projects",
  15. type: "nvarchar(max)",
  16. nullable: false,
  17. defaultValue: "");
  18. migrationBuilder.CreateTable(
  19. name: "ProjectTeam",
  20. columns: table => new
  21. {
  22. Id = table.Column<long>(type: "bigint", nullable: false)
  23. .Annotation("SqlServer:Identity", "1, 1"),
  24. CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  25. UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  26. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  27. UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  28. ProjectId = table.Column<long>(type: "bigint", nullable: false),
  29. TeamId = table.Column<long>(type: "bigint", nullable: true),
  30. AssignedUserId = table.Column<string>(type: "nvarchar(max)", nullable: false),
  31. AssignedUserName = table.Column<string>(type: "nvarchar(max)", nullable: false)
  32. },
  33. constraints: table =>
  34. {
  35. table.PrimaryKey("PK_ProjectTeam", x => x.Id);
  36. table.ForeignKey(
  37. name: "FK_ProjectTeam_Projects_TeamId",
  38. column: x => x.TeamId,
  39. principalTable: "Projects",
  40. principalColumn: "Id");
  41. });
  42. migrationBuilder.CreateIndex(
  43. name: "IX_ProjectTeam_TeamId",
  44. table: "ProjectTeam",
  45. column: "TeamId");
  46. }
  47. /// <inheritdoc />
  48. protected override void Down(MigrationBuilder migrationBuilder)
  49. {
  50. migrationBuilder.DropTable(
  51. name: "ProjectTeam");
  52. migrationBuilder.DropColumn(
  53. name: "Desc",
  54. table: "Projects");
  55. }
  56. }
  57. }