20250127103524_altrContractWorkingDays.cs 2.4 KB

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