20240304072047_addTeamMeeting.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace MTWorkHR.Infrastructure.Migrations
  5. {
  6. /// <inheritdoc />
  7. public partial class addTeamMeeting : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.AlterColumn<string>(
  13. name: "Comment",
  14. table: "UserTaskHistories",
  15. type: "nvarchar(500)",
  16. maxLength: 500,
  17. nullable: true,
  18. oldClrType: typeof(string),
  19. oldType: "nvarchar(500)",
  20. oldMaxLength: 500);
  21. migrationBuilder.AlterColumn<string>(
  22. name: "FileName",
  23. table: "UserTaskAttachments",
  24. type: "nvarchar(250)",
  25. maxLength: 250,
  26. nullable: true,
  27. oldClrType: typeof(string),
  28. oldType: "nvarchar(250)",
  29. oldMaxLength: 250);
  30. migrationBuilder.AddColumn<DateTime>(
  31. name: "CreateDate",
  32. table: "Projects",
  33. type: "datetime2",
  34. nullable: false,
  35. defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified))
  36. .Annotation("Relational:ColumnOrder", 3);
  37. migrationBuilder.AddColumn<string>(
  38. name: "CreateUser",
  39. table: "Projects",
  40. type: "nvarchar(450)",
  41. maxLength: 450,
  42. nullable: true)
  43. .Annotation("Relational:ColumnOrder", 1);
  44. migrationBuilder.AddColumn<string>(
  45. name: "DeleteUserId",
  46. table: "Projects",
  47. type: "nvarchar(450)",
  48. maxLength: 450,
  49. nullable: true)
  50. .Annotation("Relational:ColumnOrder", 8);
  51. migrationBuilder.AddColumn<bool>(
  52. name: "IsDeleted",
  53. table: "Projects",
  54. type: "bit",
  55. nullable: false,
  56. defaultValue: false)
  57. .Annotation("Relational:ColumnOrder", 7);
  58. migrationBuilder.AddColumn<DateTime>(
  59. name: "UpdateDate",
  60. table: "Projects",
  61. type: "datetime2",
  62. nullable: true)
  63. .Annotation("Relational:ColumnOrder", 4);
  64. migrationBuilder.AddColumn<string>(
  65. name: "UpdateUser",
  66. table: "Projects",
  67. type: "nvarchar(450)",
  68. maxLength: 450,
  69. nullable: true)
  70. .Annotation("Relational:ColumnOrder", 2);
  71. migrationBuilder.CreateTable(
  72. name: "Meetings",
  73. columns: table => new
  74. {
  75. Id = table.Column<long>(type: "bigint", nullable: false)
  76. .Annotation("SqlServer:Identity", "1, 1"),
  77. CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  78. UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  79. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  80. UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  81. IsDeleted = table.Column<bool>(type: "bit", nullable: false),
  82. DeleteUserId = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  83. Title = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  84. Description = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
  85. MeetingDateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
  86. MeetingLink = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true)
  87. },
  88. constraints: table =>
  89. {
  90. table.PrimaryKey("PK_Meetings", x => x.Id);
  91. });
  92. migrationBuilder.CreateTable(
  93. name: "Teams",
  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. IsDeleted = table.Column<bool>(type: "bit", nullable: false),
  103. DeleteUserId = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  104. NameAr = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  105. NameEn = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false)
  106. },
  107. constraints: table =>
  108. {
  109. table.PrimaryKey("PK_Teams", x => x.Id);
  110. });
  111. migrationBuilder.CreateTable(
  112. name: "UserTaskLogs",
  113. columns: table => new
  114. {
  115. Id = table.Column<long>(type: "bigint", nullable: false)
  116. .Annotation("SqlServer:Identity", "1, 1"),
  117. Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
  118. QueryString = table.Column<string>(type: "nvarchar(max)", nullable: true),
  119. Input = table.Column<string>(type: "nvarchar(max)", nullable: true),
  120. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  121. CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: false),
  122. ServerIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
  123. Channel = table.Column<string>(type: "nvarchar(max)", nullable: true),
  124. UserIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
  125. ServiceResponseTimeInSeconds = table.Column<string>(type: "nvarchar(max)", nullable: false),
  126. ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
  127. ErrorDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
  128. InnerException = table.Column<string>(type: "nvarchar(max)", nullable: true),
  129. userAgent = table.Column<string>(type: "nvarchar(max)", nullable: true)
  130. },
  131. constraints: table =>
  132. {
  133. table.PrimaryKey("PK_UserTaskLogs", x => x.Id);
  134. });
  135. migrationBuilder.CreateTable(
  136. name: "MeetingUser",
  137. columns: table => new
  138. {
  139. Id = table.Column<long>(type: "bigint", nullable: false)
  140. .Annotation("SqlServer:Identity", "1, 1"),
  141. CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  142. UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  143. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  144. UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  145. MeetingId = table.Column<long>(type: "bigint", nullable: false),
  146. AssignedUserId = table.Column<string>(type: "nvarchar(max)", nullable: false)
  147. },
  148. constraints: table =>
  149. {
  150. table.PrimaryKey("PK_MeetingUser", x => x.Id);
  151. table.ForeignKey(
  152. name: "FK_MeetingUser_Meetings_MeetingId",
  153. column: x => x.MeetingId,
  154. principalTable: "Meetings",
  155. principalColumn: "Id",
  156. onDelete: ReferentialAction.Cascade);
  157. });
  158. migrationBuilder.CreateTable(
  159. name: "TeamUser",
  160. columns: table => new
  161. {
  162. Id = table.Column<long>(type: "bigint", nullable: false)
  163. .Annotation("SqlServer:Identity", "1, 1"),
  164. CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  165. UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  166. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  167. UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  168. TeamId = table.Column<long>(type: "bigint", nullable: false),
  169. AssignedUserId = table.Column<string>(type: "nvarchar(max)", nullable: false)
  170. },
  171. constraints: table =>
  172. {
  173. table.PrimaryKey("PK_TeamUser", x => x.Id);
  174. table.ForeignKey(
  175. name: "FK_TeamUser_Teams_TeamId",
  176. column: x => x.TeamId,
  177. principalTable: "Teams",
  178. principalColumn: "Id",
  179. onDelete: ReferentialAction.Cascade);
  180. });
  181. migrationBuilder.CreateIndex(
  182. name: "IX_MeetingUser_MeetingId",
  183. table: "MeetingUser",
  184. column: "MeetingId");
  185. migrationBuilder.CreateIndex(
  186. name: "IX_TeamUser_TeamId",
  187. table: "TeamUser",
  188. column: "TeamId");
  189. }
  190. /// <inheritdoc />
  191. protected override void Down(MigrationBuilder migrationBuilder)
  192. {
  193. migrationBuilder.DropTable(
  194. name: "MeetingUser");
  195. migrationBuilder.DropTable(
  196. name: "TeamUser");
  197. migrationBuilder.DropTable(
  198. name: "UserTaskLogs");
  199. migrationBuilder.DropTable(
  200. name: "Meetings");
  201. migrationBuilder.DropTable(
  202. name: "Teams");
  203. migrationBuilder.DropColumn(
  204. name: "CreateDate",
  205. table: "Projects");
  206. migrationBuilder.DropColumn(
  207. name: "CreateUser",
  208. table: "Projects");
  209. migrationBuilder.DropColumn(
  210. name: "DeleteUserId",
  211. table: "Projects");
  212. migrationBuilder.DropColumn(
  213. name: "IsDeleted",
  214. table: "Projects");
  215. migrationBuilder.DropColumn(
  216. name: "UpdateDate",
  217. table: "Projects");
  218. migrationBuilder.DropColumn(
  219. name: "UpdateUser",
  220. table: "Projects");
  221. migrationBuilder.AlterColumn<string>(
  222. name: "Comment",
  223. table: "UserTaskHistories",
  224. type: "nvarchar(500)",
  225. maxLength: 500,
  226. nullable: false,
  227. defaultValue: "",
  228. oldClrType: typeof(string),
  229. oldType: "nvarchar(500)",
  230. oldMaxLength: 500,
  231. oldNullable: true);
  232. migrationBuilder.AlterColumn<string>(
  233. name: "FileName",
  234. table: "UserTaskAttachments",
  235. type: "nvarchar(250)",
  236. maxLength: 250,
  237. nullable: false,
  238. defaultValue: "",
  239. oldClrType: typeof(string),
  240. oldType: "nvarchar(250)",
  241. oldMaxLength: 250,
  242. oldNullable: true);
  243. }
  244. }
  245. }