20260212015759_a6.cs 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Persistence.Migrations
  5. {
  6. /// <inheritdoc />
  7. public partial class a6 : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "AdminAccessLog",
  14. columns: table => new
  15. {
  16. ID = table.Column<long>(type: "bigint", nullable: false, comment: "PK")
  17. .Annotation("SqlServer:Identity", "1, 1"),
  18. UserID = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false, comment: "관리자 사용자 ID"),
  19. UserName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "관리자 사용자 이름"),
  20. Method = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false, comment: "HTTP Method"),
  21. Path = table.Column<string>(type: "nvarchar(2048)", maxLength: 2048, nullable: false, comment: "요청 경로"),
  22. QueryString = table.Column<string>(type: "nvarchar(2048)", maxLength: 2048, nullable: true, comment: "쿼리 스트링"),
  23. StatusCode = table.Column<int>(type: "int", nullable: false, comment: "응답 상태 코드"),
  24. ElapsedMs = table.Column<long>(type: "bigint", nullable: false, comment: "처리 시간 (밀리초)"),
  25. MenuName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true, comment: "메뉴 이름"),
  26. IpAddress = table.Column<string>(type: "nvarchar(45)", maxLength: 45, nullable: true, comment: "IP 주소"),
  27. UserAgent = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true, comment: "User Agent"),
  28. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "생성 일시")
  29. },
  30. constraints: table =>
  31. {
  32. table.PrimaryKey("PK_AdminAccessLog", x => x.ID);
  33. },
  34. comment: "관리자 접근 기록");
  35. migrationBuilder.CreateTable(
  36. name: "AdminLoginLog",
  37. columns: table => new
  38. {
  39. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  40. .Annotation("SqlServer:Identity", "1, 1"),
  41. Success = table.Column<bool>(type: "bit", nullable: false, comment: "로그인 성공 여부"),
  42. Account = table.Column<string>(type: "nvarchar(120)", maxLength: 120, nullable: false, comment: "로그인 시도 계정"),
  43. Reason = table.Column<string>(type: "nvarchar(225)", maxLength: 225, nullable: true, comment: "실패 사유"),
  44. IpAddress = table.Column<string>(type: "nvarchar(45)", maxLength: 45, nullable: true, comment: "IP 주소"),
  45. UserAgent = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true, comment: "User Agent"),
  46. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "생성 일시")
  47. },
  48. constraints: table =>
  49. {
  50. table.PrimaryKey("PK_AdminLoginLog", x => x.ID);
  51. },
  52. comment: "관리자 로그인 기록");
  53. migrationBuilder.CreateIndex(
  54. name: "IX_AdminAccessLog_CreatedAt",
  55. table: "AdminAccessLog",
  56. column: "CreatedAt");
  57. migrationBuilder.CreateIndex(
  58. name: "IX_AdminAccessLog_UserID",
  59. table: "AdminAccessLog",
  60. column: "UserID");
  61. migrationBuilder.CreateIndex(
  62. name: "IX_AdminLoginLog_Account",
  63. table: "AdminLoginLog",
  64. column: "Account");
  65. migrationBuilder.CreateIndex(
  66. name: "IX_AdminLoginLog_CreatedAt",
  67. table: "AdminLoginLog",
  68. column: "CreatedAt");
  69. }
  70. /// <inheritdoc />
  71. protected override void Down(MigrationBuilder migrationBuilder)
  72. {
  73. migrationBuilder.DropTable(
  74. name: "AdminAccessLog");
  75. migrationBuilder.DropTable(
  76. name: "AdminLoginLog");
  77. }
  78. }
  79. }