20250124015524_AddMember.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace bitforum.Migrations.DefaultDb
  5. {
  6. /// <inheritdoc />
  7. public partial class AddMember : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.AlterColumn<string>(
  13. name: "Image",
  14. table: "BannerItem",
  15. type: "nvarchar(1024)",
  16. maxLength: 1024,
  17. nullable: true,
  18. oldClrType: typeof(string),
  19. oldType: "nvarchar(1024)",
  20. oldMaxLength: 1024);
  21. migrationBuilder.CreateTable(
  22. name: "MemberApprove",
  23. columns: table => new
  24. {
  25. ID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID")
  26. .Annotation("SqlServer:Identity", "1, 1"),
  27. IsReceiveSMS = table.Column<bool>(type: "bit", nullable: false, comment: "SMS 수신 여부"),
  28. IsReceiveEmail = table.Column<bool>(type: "bit", nullable: false, comment: "E-MAIL 수신 여부"),
  29. IsReceiveNote = table.Column<bool>(type: "bit", nullable: false, comment: "쪽지 수신 여부"),
  30. IsDisclosureInvest = table.Column<bool>(type: "bit", nullable: false, comment: "투자 현황 공개 여부")
  31. },
  32. constraints: table =>
  33. {
  34. table.PrimaryKey("PK_MemberApprove", x => x.ID);
  35. },
  36. comment: "회원 동의 및 수신 여부");
  37. migrationBuilder.CreateTable(
  38. name: "MemberGrade",
  39. columns: table => new
  40. {
  41. ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
  42. .Annotation("SqlServer:Identity", "1, 1"),
  43. KorName = table.Column<string>(type: "nvarchar(120)", maxLength: 120, nullable: false, comment: "한글 명"),
  44. EngName = table.Column<string>(type: "nvarchar(120)", maxLength: 120, nullable: false, comment: "영문 명"),
  45. Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true, comment: "설명"),
  46. Order = table.Column<short>(type: "smallint", nullable: false, comment: "순서"),
  47. Image = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "이미지"),
  48. RequiredExp = table.Column<int>(type: "int", nullable: false, comment: "최소 경험치(Exp)"),
  49. RequiredCoin = table.Column<int>(type: "int", nullable: false, comment: "최소 코인(Coin)"),
  50. IsActive = table.Column<bool>(type: "bit", nullable: false, comment: "사용 여부"),
  51. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
  52. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
  53. },
  54. constraints: table =>
  55. {
  56. table.PrimaryKey("PK_MemberGrade", x => x.ID);
  57. },
  58. comment: "회원 등급");
  59. migrationBuilder.CreateTable(
  60. name: "Member",
  61. columns: table => new
  62. {
  63. ID = table.Column<int>(type: "int", nullable: false, comment: "PK"),
  64. GradeID = table.Column<int>(type: "int", nullable: true, comment: "회원등급 ID"),
  65. SID = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false, comment: "SID"),
  66. Email = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "이메일"),
  67. Name = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, comment: "별명"),
  68. FullName = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true, comment: "본명"),
  69. FirstName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, comment: "본명(성)"),
  70. LastName = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true, comment: "본명(이름)"),
  71. Password = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "비밀번호"),
  72. Intro = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true, comment: "자기소개"),
  73. Summary = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "한마디"),
  74. Coin = table.Column<long>(type: "bigint", nullable: false, comment: "코인"),
  75. Exp = table.Column<int>(type: "int", nullable: false, comment: "경험치"),
  76. Phone = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: true, comment: "연락처"),
  77. Birthday = table.Column<DateOnly>(type: "date", maxLength: 10, nullable: true, comment: "생년월일"),
  78. Gender = table.Column<int>(type: "int", maxLength: 6, nullable: true, comment: "성별"),
  79. Photo = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "사진"),
  80. IsEmailVerified = table.Column<bool>(type: "bit", nullable: false, comment: "이메일 인증 여부"),
  81. IsAuthCertified = table.Column<bool>(type: "bit", nullable: false, comment: "본인 인증 여부"),
  82. IsDenied = table.Column<bool>(type: "bit", nullable: false, comment: "차단 여부"),
  83. IsAdmin = table.Column<bool>(type: "bit", nullable: false, comment: "운영진 여부"),
  84. IsWithdraw = table.Column<bool>(type: "bit", nullable: false, comment: "탈퇴 여부"),
  85. Following = table.Column<int>(type: "int", nullable: false, comment: "구독 중"),
  86. Followed = table.Column<int>(type: "int", nullable: false, comment: "구독자"),
  87. DeviceInfo = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: true, comment: "로그인 단말기 정보"),
  88. SignupIP = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: false, comment: "회원가입 시 IP"),
  89. LastLoginIp = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: true, comment: "마지막 로그인 IP"),
  90. LastLoginAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "마지막 로그인 일시"),
  91. EmailVerifiedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "이메일 인증 일시"),
  92. AuthCertifiedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "본인인증 일시"),
  93. PasswordUpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "비밀번호 변경 일시"),
  94. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "가입 일시"),
  95. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
  96. DeletedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "탈퇴 일시")
  97. },
  98. constraints: table =>
  99. {
  100. table.PrimaryKey("PK_Member", x => x.ID);
  101. table.ForeignKey(
  102. name: "FK_Member_MemberApprove_ID",
  103. column: x => x.ID,
  104. principalTable: "MemberApprove",
  105. principalColumn: "ID",
  106. onDelete: ReferentialAction.Cascade);
  107. table.ForeignKey(
  108. name: "FK_Member_MemberGrade_GradeID",
  109. column: x => x.GradeID,
  110. principalTable: "MemberGrade",
  111. principalColumn: "ID");
  112. },
  113. comment: "회원 정보");
  114. migrationBuilder.CreateIndex(
  115. name: "IX_BannerPosition_IsActive",
  116. table: "BannerPosition",
  117. column: "IsActive");
  118. migrationBuilder.CreateIndex(
  119. name: "IX_Member_Email",
  120. table: "Member",
  121. column: "Email",
  122. unique: true);
  123. migrationBuilder.CreateIndex(
  124. name: "IX_Member_GradeID",
  125. table: "Member",
  126. column: "GradeID");
  127. migrationBuilder.CreateIndex(
  128. name: "IX_Member_Name",
  129. table: "Member",
  130. column: "Name",
  131. unique: true,
  132. filter: "[Name] IS NOT NULL");
  133. migrationBuilder.CreateIndex(
  134. name: "IX_Member_SID",
  135. table: "Member",
  136. column: "SID",
  137. unique: true);
  138. migrationBuilder.CreateIndex(
  139. name: "IX_MemberGrade_EngName",
  140. table: "MemberGrade",
  141. column: "EngName",
  142. unique: true);
  143. migrationBuilder.CreateIndex(
  144. name: "IX_MemberGrade_KorName",
  145. table: "MemberGrade",
  146. column: "KorName",
  147. unique: true);
  148. }
  149. /// <inheritdoc />
  150. protected override void Down(MigrationBuilder migrationBuilder)
  151. {
  152. migrationBuilder.DropTable(
  153. name: "Member");
  154. migrationBuilder.DropTable(
  155. name: "MemberApprove");
  156. migrationBuilder.DropTable(
  157. name: "MemberGrade");
  158. migrationBuilder.DropIndex(
  159. name: "IX_BannerPosition_IsActive",
  160. table: "BannerPosition");
  161. migrationBuilder.AlterColumn<string>(
  162. name: "Image",
  163. table: "BannerItem",
  164. type: "nvarchar(1024)",
  165. maxLength: 1024,
  166. nullable: false,
  167. defaultValue: "",
  168. oldClrType: typeof(string),
  169. oldType: "nvarchar(1024)",
  170. oldMaxLength: 1024,
  171. oldNullable: true);
  172. }
  173. }
  174. }