20240319090340_altrOrder.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace MTWorkHR.Infrastructure.Migrations
  5. {
  6. /// <inheritdoc />
  7. public partial class altrOrder : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.DropColumn(
  13. name: "DateActioned",
  14. table: "OrderRequests");
  15. migrationBuilder.DropColumn(
  16. name: "DateRequested",
  17. table: "OrderRequests");
  18. migrationBuilder.DropColumn(
  19. name: "IsApproved",
  20. table: "OrderRequests");
  21. migrationBuilder.DropColumn(
  22. name: "IsCancelled",
  23. table: "OrderRequests");
  24. migrationBuilder.AlterColumn<DateTime>(
  25. name: "EndDate",
  26. table: "OrderRequests",
  27. type: "datetime2",
  28. nullable: true,
  29. oldClrType: typeof(DateTime),
  30. oldType: "datetime2");
  31. migrationBuilder.AddColumn<int>(
  32. name: "CityId",
  33. table: "OrderRequests",
  34. type: "int",
  35. nullable: true);
  36. migrationBuilder.AddColumn<int>(
  37. name: "CountryId",
  38. table: "OrderRequests",
  39. type: "int",
  40. nullable: true);
  41. migrationBuilder.AddColumn<long>(
  42. name: "LeaveTypeId",
  43. table: "OrderRequests",
  44. type: "bigint",
  45. nullable: true);
  46. migrationBuilder.AddColumn<int>(
  47. name: "OrderStatus",
  48. table: "OrderRequests",
  49. type: "int",
  50. nullable: true);
  51. migrationBuilder.CreateTable(
  52. name: "LeaveTypes",
  53. columns: table => new
  54. {
  55. Id = table.Column<long>(type: "bigint", nullable: false)
  56. .Annotation("SqlServer:Identity", "1, 1"),
  57. CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  58. UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  59. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  60. UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  61. NameAr = table.Column<string>(type: "nvarchar(max)", nullable: false),
  62. NameEn = table.Column<string>(type: "nvarchar(max)", nullable: false),
  63. DefaultDays = table.Column<int>(type: "int", nullable: false)
  64. },
  65. constraints: table =>
  66. {
  67. table.PrimaryKey("PK_LeaveTypes", x => x.Id);
  68. });
  69. migrationBuilder.CreateIndex(
  70. name: "IX_OrderRequests_LeaveTypeId",
  71. table: "OrderRequests",
  72. column: "LeaveTypeId");
  73. migrationBuilder.AddForeignKey(
  74. name: "FK_OrderRequests_LeaveTypes_LeaveTypeId",
  75. table: "OrderRequests",
  76. column: "LeaveTypeId",
  77. principalTable: "LeaveTypes",
  78. principalColumn: "Id");
  79. }
  80. /// <inheritdoc />
  81. protected override void Down(MigrationBuilder migrationBuilder)
  82. {
  83. migrationBuilder.DropForeignKey(
  84. name: "FK_OrderRequests_LeaveTypes_LeaveTypeId",
  85. table: "OrderRequests");
  86. migrationBuilder.DropTable(
  87. name: "LeaveTypes");
  88. migrationBuilder.DropIndex(
  89. name: "IX_OrderRequests_LeaveTypeId",
  90. table: "OrderRequests");
  91. migrationBuilder.DropColumn(
  92. name: "CityId",
  93. table: "OrderRequests");
  94. migrationBuilder.DropColumn(
  95. name: "CountryId",
  96. table: "OrderRequests");
  97. migrationBuilder.DropColumn(
  98. name: "LeaveTypeId",
  99. table: "OrderRequests");
  100. migrationBuilder.DropColumn(
  101. name: "OrderStatus",
  102. table: "OrderRequests");
  103. migrationBuilder.AlterColumn<DateTime>(
  104. name: "EndDate",
  105. table: "OrderRequests",
  106. type: "datetime2",
  107. nullable: false,
  108. defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
  109. oldClrType: typeof(DateTime),
  110. oldType: "datetime2",
  111. oldNullable: true);
  112. migrationBuilder.AddColumn<DateTime>(
  113. name: "DateActioned",
  114. table: "OrderRequests",
  115. type: "datetime2",
  116. nullable: true);
  117. migrationBuilder.AddColumn<DateTime>(
  118. name: "DateRequested",
  119. table: "OrderRequests",
  120. type: "datetime2",
  121. nullable: false,
  122. defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
  123. migrationBuilder.AddColumn<bool>(
  124. name: "IsApproved",
  125. table: "OrderRequests",
  126. type: "bit",
  127. nullable: true);
  128. migrationBuilder.AddColumn<bool>(
  129. name: "IsCancelled",
  130. table: "OrderRequests",
  131. type: "bit",
  132. nullable: false,
  133. defaultValue: false);
  134. }
  135. }
  136. }