20240311151145_attendance.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. LoginTime = table.Column<DateTime>(type: "datetime2", nullable: true),
  66. CheckInTime = table.Column<DateTime>(type: "datetime2", nullable: true),
  67. CheckOutTime = table.Column<DateTime>(type: "datetime2", nullable: true),
  68. AttendanceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  69. LeaveType = table.Column<int>(type: "int", nullable: false),
  70. LeaveReason = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true)
  71. },
  72. constraints: table =>
  73. {
  74. table.PrimaryKey("PK_Attendances", x => x.Id);
  75. });
  76. }
  77. /// <inheritdoc />
  78. protected override void Down(MigrationBuilder migrationBuilder)
  79. {
  80. migrationBuilder.DropTable(
  81. name: "AttendanceLogs");
  82. migrationBuilder.DropTable(
  83. name: "Attendances");
  84. migrationBuilder.DropColumn(
  85. name: "DeleteUserId",
  86. table: "Companies");
  87. migrationBuilder.AlterColumn<bool>(
  88. name: "IsDeleted",
  89. table: "Companies",
  90. type: "bit",
  91. nullable: false,
  92. oldClrType: typeof(bool),
  93. oldType: "bit")
  94. .OldAnnotation("Relational:ColumnOrder", 7);
  95. }
  96. }
  97. }