20240313083213_attendance.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace MTWorkHR.Infrastructure.Migrations
  5. {
  6. /// <inheritdoc />
  7. public partial class attendance : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.AlterColumn<bool>(
  13. name: "IsDeleted",
  14. table: "Companies",
  15. type: "bit",
  16. nullable: false,
  17. oldClrType: typeof(bool),
  18. oldType: "bit")
  19. .Annotation("Relational:ColumnOrder", 7);
  20. migrationBuilder.AddColumn<string>(
  21. name: "DeleteUserId",
  22. table: "Companies",
  23. type: "nvarchar(450)",
  24. maxLength: 450,
  25. nullable: true)
  26. .Annotation("Relational:ColumnOrder", 8);
  27. migrationBuilder.CreateTable(
  28. name: "AttendanceLogs",
  29. columns: table => new
  30. {
  31. Id = table.Column<long>(type: "bigint", nullable: false)
  32. .Annotation("SqlServer:Identity", "1, 1"),
  33. Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
  34. QueryString = table.Column<string>(type: "nvarchar(max)", nullable: true),
  35. Input = table.Column<string>(type: "nvarchar(max)", nullable: true),
  36. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  37. CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: false),
  38. ServerIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
  39. Channel = table.Column<string>(type: "nvarchar(max)", nullable: true),
  40. UserIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
  41. ServiceResponseTimeInSeconds = table.Column<string>(type: "nvarchar(max)", nullable: false),
  42. ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
  43. ErrorDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
  44. InnerException = table.Column<string>(type: "nvarchar(max)", nullable: true),
  45. userAgent = table.Column<string>(type: "nvarchar(max)", nullable: true)
  46. },
  47. constraints: table =>
  48. {
  49. table.PrimaryKey("PK_AttendanceLogs", x => x.Id);
  50. });
  51. migrationBuilder.CreateTable(
  52. name: "Attendances",
  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. IsDeleted = table.Column<bool>(type: "bit", nullable: false),
  62. DeleteUserId = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  63. UserId = table.Column<string>(type: "nvarchar(max)", nullable: false),
  64. UserName = table.Column<string>(type: "nvarchar(max)", nullable: true),
  65. CheckInTime = table.Column<DateTime>(type: "datetime2", nullable: true),
  66. CheckOutTime = table.Column<DateTime>(type: "datetime2", nullable: true),
  67. AttendanceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  68. LeaveType = table.Column<int>(type: "int", nullable: false),
  69. LeaveReason = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true)
  70. },
  71. constraints: table =>
  72. {
  73. table.PrimaryKey("PK_Attendances", x => x.Id);
  74. });
  75. }
  76. /// <inheritdoc />
  77. protected override void Down(MigrationBuilder migrationBuilder)
  78. {
  79. migrationBuilder.DropTable(
  80. name: "AttendanceLogs");
  81. migrationBuilder.DropTable(
  82. name: "Attendances");
  83. migrationBuilder.DropColumn(
  84. name: "DeleteUserId",
  85. table: "Companies");
  86. migrationBuilder.AlterColumn<bool>(
  87. name: "IsDeleted",
  88. table: "Companies",
  89. type: "bit",
  90. nullable: false,
  91. oldClrType: typeof(bool),
  92. oldType: "bit")
  93. .OldAnnotation("Relational:ColumnOrder", 7);
  94. }
  95. }
  96. }