20241216201032_altrContractWorkingDay.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace MTWorkHR.Infrastructure.Migrations
  5. {
  6. /// <inheritdoc />
  7. public partial class altrContractWorkingDay : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.DropColumn(
  13. name: "WorkingDays",
  14. table: "Contracts");
  15. migrationBuilder.AlterColumn<int>(
  16. name: "WorkingHoursNum",
  17. table: "Contracts",
  18. type: "int",
  19. nullable: true,
  20. oldClrType: typeof(int),
  21. oldType: "int");
  22. migrationBuilder.AlterColumn<int>(
  23. name: "WorkingHours",
  24. table: "Contracts",
  25. type: "int",
  26. nullable: true,
  27. oldClrType: typeof(int),
  28. oldType: "int");
  29. migrationBuilder.AlterColumn<int>(
  30. name: "WorkStateId",
  31. table: "Contracts",
  32. type: "int",
  33. nullable: true,
  34. oldClrType: typeof(int),
  35. oldType: "int");
  36. migrationBuilder.AlterColumn<int>(
  37. name: "WorkCountryId",
  38. table: "Contracts",
  39. type: "int",
  40. nullable: true,
  41. oldClrType: typeof(int),
  42. oldType: "int");
  43. migrationBuilder.AlterColumn<int>(
  44. name: "WhoCanTerminateContractInTrial",
  45. table: "Contracts",
  46. type: "int",
  47. nullable: true,
  48. oldClrType: typeof(int),
  49. oldType: "int");
  50. migrationBuilder.AlterColumn<int>(
  51. name: "WhoCanTerminateContract",
  52. table: "Contracts",
  53. type: "int",
  54. nullable: true,
  55. oldClrType: typeof(int),
  56. oldType: "int");
  57. migrationBuilder.AlterColumn<int>(
  58. name: "VacationDays",
  59. table: "Contracts",
  60. type: "int",
  61. nullable: true,
  62. oldClrType: typeof(int),
  63. oldType: "int");
  64. migrationBuilder.AlterColumn<int>(
  65. name: "NoticePeriodBeforeTermination",
  66. table: "Contracts",
  67. type: "int",
  68. nullable: true,
  69. oldClrType: typeof(int),
  70. oldType: "int");
  71. migrationBuilder.AlterColumn<int>(
  72. name: "ContractorTaxResidencyId",
  73. table: "Contracts",
  74. type: "int",
  75. nullable: true,
  76. oldClrType: typeof(int),
  77. oldType: "int");
  78. migrationBuilder.AlterColumn<int>(
  79. name: "ContractDurationId",
  80. table: "Contracts",
  81. type: "int",
  82. nullable: true,
  83. oldClrType: typeof(int),
  84. oldType: "int");
  85. migrationBuilder.AlterColumn<string>(
  86. name: "BillingCycle",
  87. table: "Contracts",
  88. type: "nvarchar(max)",
  89. nullable: true,
  90. oldClrType: typeof(int),
  91. oldType: "int");
  92. migrationBuilder.CreateTable(
  93. name: "ContractWorkingDay",
  94. columns: table => new
  95. {
  96. Id = table.Column<long>(type: "bigint", nullable: false)
  97. .Annotation("SqlServer:Identity", "1, 1"),
  98. CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  99. UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  100. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  101. UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  102. ContractId = table.Column<long>(type: "bigint", nullable: false),
  103. WorkingDay = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false)
  104. },
  105. constraints: table =>
  106. {
  107. table.PrimaryKey("PK_ContractWorkingDay", x => x.Id);
  108. table.ForeignKey(
  109. name: "FK_ContractWorkingDay_Contracts_ContractId",
  110. column: x => x.ContractId,
  111. principalTable: "Contracts",
  112. principalColumn: "Id",
  113. onDelete: ReferentialAction.Cascade);
  114. });
  115. migrationBuilder.CreateIndex(
  116. name: "IX_ContractWorkingDay_ContractId",
  117. table: "ContractWorkingDay",
  118. column: "ContractId");
  119. }
  120. /// <inheritdoc />
  121. protected override void Down(MigrationBuilder migrationBuilder)
  122. {
  123. migrationBuilder.DropTable(
  124. name: "ContractWorkingDay");
  125. migrationBuilder.AlterColumn<int>(
  126. name: "WorkingHoursNum",
  127. table: "Contracts",
  128. type: "int",
  129. nullable: false,
  130. defaultValue: 0,
  131. oldClrType: typeof(int),
  132. oldType: "int",
  133. oldNullable: true);
  134. migrationBuilder.AlterColumn<int>(
  135. name: "WorkingHours",
  136. table: "Contracts",
  137. type: "int",
  138. nullable: false,
  139. defaultValue: 0,
  140. oldClrType: typeof(int),
  141. oldType: "int",
  142. oldNullable: true);
  143. migrationBuilder.AlterColumn<int>(
  144. name: "WorkStateId",
  145. table: "Contracts",
  146. type: "int",
  147. nullable: false,
  148. defaultValue: 0,
  149. oldClrType: typeof(int),
  150. oldType: "int",
  151. oldNullable: true);
  152. migrationBuilder.AlterColumn<int>(
  153. name: "WorkCountryId",
  154. table: "Contracts",
  155. type: "int",
  156. nullable: false,
  157. defaultValue: 0,
  158. oldClrType: typeof(int),
  159. oldType: "int",
  160. oldNullable: true);
  161. migrationBuilder.AlterColumn<int>(
  162. name: "WhoCanTerminateContractInTrial",
  163. table: "Contracts",
  164. type: "int",
  165. nullable: false,
  166. defaultValue: 0,
  167. oldClrType: typeof(int),
  168. oldType: "int",
  169. oldNullable: true);
  170. migrationBuilder.AlterColumn<int>(
  171. name: "WhoCanTerminateContract",
  172. table: "Contracts",
  173. type: "int",
  174. nullable: false,
  175. defaultValue: 0,
  176. oldClrType: typeof(int),
  177. oldType: "int",
  178. oldNullable: true);
  179. migrationBuilder.AlterColumn<int>(
  180. name: "VacationDays",
  181. table: "Contracts",
  182. type: "int",
  183. nullable: false,
  184. defaultValue: 0,
  185. oldClrType: typeof(int),
  186. oldType: "int",
  187. oldNullable: true);
  188. migrationBuilder.AlterColumn<int>(
  189. name: "NoticePeriodBeforeTermination",
  190. table: "Contracts",
  191. type: "int",
  192. nullable: false,
  193. defaultValue: 0,
  194. oldClrType: typeof(int),
  195. oldType: "int",
  196. oldNullable: true);
  197. migrationBuilder.AlterColumn<int>(
  198. name: "ContractorTaxResidencyId",
  199. table: "Contracts",
  200. type: "int",
  201. nullable: false,
  202. defaultValue: 0,
  203. oldClrType: typeof(int),
  204. oldType: "int",
  205. oldNullable: true);
  206. migrationBuilder.AlterColumn<int>(
  207. name: "ContractDurationId",
  208. table: "Contracts",
  209. type: "int",
  210. nullable: false,
  211. defaultValue: 0,
  212. oldClrType: typeof(int),
  213. oldType: "int",
  214. oldNullable: true);
  215. migrationBuilder.AlterColumn<int>(
  216. name: "BillingCycle",
  217. table: "Contracts",
  218. type: "int",
  219. nullable: false,
  220. defaultValue: 0,
  221. oldClrType: typeof(string),
  222. oldType: "nvarchar(max)",
  223. oldNullable: true);
  224. migrationBuilder.AddColumn<string>(
  225. name: "WorkingDays",
  226. table: "Contracts",
  227. type: "nvarchar(max)",
  228. nullable: false,
  229. defaultValue: "");
  230. }
  231. }
  232. }