20240730154025_addTaskUserTbl.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace MTWorkHR.Infrastructure.Migrations
  5. {
  6. /// <inheritdoc />
  7. public partial class addTaskUserTbl : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "TaskUser",
  14. columns: table => new
  15. {
  16. Id = table.Column<long>(type: "bigint", nullable: false)
  17. .Annotation("SqlServer:Identity", "1, 1"),
  18. CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  19. UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  20. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  21. UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  22. TaskId = table.Column<long>(type: "bigint", nullable: false),
  23. AssignedUserId = table.Column<string>(type: "nvarchar(max)", nullable: false),
  24. AssignedUserName = table.Column<string>(type: "nvarchar(max)", nullable: true)
  25. },
  26. constraints: table =>
  27. {
  28. table.PrimaryKey("PK_TaskUser", x => x.Id);
  29. table.ForeignKey(
  30. name: "FK_TaskUser_UserTasks_TaskId",
  31. column: x => x.TaskId,
  32. principalTable: "UserTasks",
  33. principalColumn: "Id",
  34. onDelete: ReferentialAction.Cascade);
  35. });
  36. migrationBuilder.CreateIndex(
  37. name: "IX_TaskUser_TaskId",
  38. table: "TaskUser",
  39. column: "TaskId");
  40. }
  41. /// <inheritdoc />
  42. protected override void Down(MigrationBuilder migrationBuilder)
  43. {
  44. migrationBuilder.DropTable(
  45. name: "TaskUser");
  46. }
  47. }
  48. }