20260212015759_a6.cs 4.1 KB

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