20260706055441_AddStatusItems.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Migrations.AppDb
  5. {
  6. /// <inheritdoc />
  7. public partial class AddStatusItems : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.AlterTable(
  13. name: "MemberItem",
  14. comment: "계정 귀속 아이템 (지위 아이템 장착형 + 소모품)",
  15. oldComment: "계정 귀속 소모품 아이템");
  16. migrationBuilder.AlterColumn<byte>(
  17. name: "ItemKind",
  18. table: "Product",
  19. type: "tinyint",
  20. nullable: true,
  21. comment: "아이템 종류 (null=일반상품, 2~4=지위, 5~11=소모품)",
  22. oldClrType: typeof(byte),
  23. oldType: "tinyint",
  24. oldNullable: true,
  25. oldComment: "소모품 종류 (null=일반상품, 5~11=소모품)");
  26. migrationBuilder.AlterColumn<int>(
  27. name: "DurationDays",
  28. table: "Product",
  29. type: "int",
  30. nullable: false,
  31. defaultValue: 0,
  32. comment: "아이템 효과 지속일 (0=즉시소모/영구)",
  33. oldClrType: typeof(int),
  34. oldType: "int",
  35. oldDefaultValue: 0,
  36. oldComment: "소모품 효과 지속일 (0=즉시소모)");
  37. migrationBuilder.AddColumn<string>(
  38. name: "EffectPayload",
  39. table: "Product",
  40. type: "nvarchar(max)",
  41. nullable: true,
  42. comment: "지위 아이템 효과 페이로드 JSON (색상·아이콘·애니메이션)");
  43. migrationBuilder.AddColumn<bool>(
  44. name: "IsGiftable",
  45. table: "Product",
  46. type: "bit",
  47. nullable: false,
  48. defaultValue: false,
  49. comment: "선물하기 가능 여부");
  50. migrationBuilder.AddColumn<string>(
  51. name: "GiftMessage",
  52. table: "Order",
  53. type: "nvarchar(200)",
  54. maxLength: 200,
  55. nullable: true,
  56. comment: "선물 메시지");
  57. migrationBuilder.AddColumn<int>(
  58. name: "GiftToMemberID",
  59. table: "Order",
  60. type: "int",
  61. nullable: true,
  62. comment: "선물 수신자 회원 ID (null=본인구매)");
  63. migrationBuilder.AlterColumn<int>(
  64. name: "MemberID",
  65. table: "MemberItem",
  66. type: "int",
  67. nullable: false,
  68. comment: "회원 ID (지급 대상)",
  69. oldClrType: typeof(int),
  70. oldType: "int",
  71. oldComment: "회원 ID");
  72. migrationBuilder.AlterColumn<byte>(
  73. name: "Kind",
  74. table: "MemberItem",
  75. type: "tinyint",
  76. nullable: false,
  77. comment: "아이템 종류 (2~4=지위, 5~11=소모품)",
  78. oldClrType: typeof(byte),
  79. oldType: "tinyint",
  80. oldComment: "아이템 종류 (5~11)");
  81. migrationBuilder.AlterColumn<int>(
  82. name: "DurationDays",
  83. table: "MemberItem",
  84. type: "int",
  85. nullable: false,
  86. defaultValue: 0,
  87. comment: "효과 지속일 (0=즉시소모/영구)",
  88. oldClrType: typeof(int),
  89. oldType: "int",
  90. oldDefaultValue: 0,
  91. oldComment: "효과 지속일 (0=즉시소모)");
  92. migrationBuilder.AddColumn<byte>(
  93. name: "EquipSlot",
  94. table: "MemberItem",
  95. type: "tinyint",
  96. nullable: true,
  97. comment: "장착 슬롯 (1=Badge, 2=NicknameEffect, 3=CommentEffect, null=소모품)");
  98. migrationBuilder.AddColumn<DateTime>(
  99. name: "ExpiresAt",
  100. table: "MemberItem",
  101. type: "datetime2",
  102. nullable: true,
  103. comment: "만료 일시 (null=영구)");
  104. migrationBuilder.AddColumn<int>(
  105. name: "GiftFromMemberID",
  106. table: "MemberItem",
  107. type: "int",
  108. nullable: true,
  109. comment: "선물 발신자 회원 ID (null=본인구매)");
  110. migrationBuilder.AddColumn<bool>(
  111. name: "IsEquipped",
  112. table: "MemberItem",
  113. type: "bit",
  114. nullable: false,
  115. defaultValue: false,
  116. comment: "장착 여부 (지위 아이템)");
  117. migrationBuilder.CreateIndex(
  118. name: "IX_MemberItem_MemberID_EquipSlot",
  119. table: "MemberItem",
  120. columns: new[] { "MemberID", "EquipSlot" },
  121. unique: true,
  122. filter: "[IsEquipped] = 1");
  123. migrationBuilder.CreateIndex(
  124. name: "IX_MemberItem_MemberID_ExpiresAt",
  125. table: "MemberItem",
  126. columns: new[] { "MemberID", "ExpiresAt" });
  127. }
  128. /// <inheritdoc />
  129. protected override void Down(MigrationBuilder migrationBuilder)
  130. {
  131. migrationBuilder.DropIndex(
  132. name: "IX_MemberItem_MemberID_EquipSlot",
  133. table: "MemberItem");
  134. migrationBuilder.DropIndex(
  135. name: "IX_MemberItem_MemberID_ExpiresAt",
  136. table: "MemberItem");
  137. migrationBuilder.DropColumn(
  138. name: "EffectPayload",
  139. table: "Product");
  140. migrationBuilder.DropColumn(
  141. name: "IsGiftable",
  142. table: "Product");
  143. migrationBuilder.DropColumn(
  144. name: "GiftMessage",
  145. table: "Order");
  146. migrationBuilder.DropColumn(
  147. name: "GiftToMemberID",
  148. table: "Order");
  149. migrationBuilder.DropColumn(
  150. name: "EquipSlot",
  151. table: "MemberItem");
  152. migrationBuilder.DropColumn(
  153. name: "ExpiresAt",
  154. table: "MemberItem");
  155. migrationBuilder.DropColumn(
  156. name: "GiftFromMemberID",
  157. table: "MemberItem");
  158. migrationBuilder.DropColumn(
  159. name: "IsEquipped",
  160. table: "MemberItem");
  161. migrationBuilder.AlterTable(
  162. name: "MemberItem",
  163. comment: "계정 귀속 소모품 아이템",
  164. oldComment: "계정 귀속 아이템 (지위 아이템 장착형 + 소모품)");
  165. migrationBuilder.AlterColumn<byte>(
  166. name: "ItemKind",
  167. table: "Product",
  168. type: "tinyint",
  169. nullable: true,
  170. comment: "소모품 종류 (null=일반상품, 5~11=소모품)",
  171. oldClrType: typeof(byte),
  172. oldType: "tinyint",
  173. oldNullable: true,
  174. oldComment: "아이템 종류 (null=일반상품, 2~4=지위, 5~11=소모품)");
  175. migrationBuilder.AlterColumn<int>(
  176. name: "DurationDays",
  177. table: "Product",
  178. type: "int",
  179. nullable: false,
  180. defaultValue: 0,
  181. comment: "소모품 효과 지속일 (0=즉시소모)",
  182. oldClrType: typeof(int),
  183. oldType: "int",
  184. oldDefaultValue: 0,
  185. oldComment: "아이템 효과 지속일 (0=즉시소모/영구)");
  186. migrationBuilder.AlterColumn<int>(
  187. name: "MemberID",
  188. table: "MemberItem",
  189. type: "int",
  190. nullable: false,
  191. comment: "회원 ID",
  192. oldClrType: typeof(int),
  193. oldType: "int",
  194. oldComment: "회원 ID (지급 대상)");
  195. migrationBuilder.AlterColumn<byte>(
  196. name: "Kind",
  197. table: "MemberItem",
  198. type: "tinyint",
  199. nullable: false,
  200. comment: "아이템 종류 (5~11)",
  201. oldClrType: typeof(byte),
  202. oldType: "tinyint",
  203. oldComment: "아이템 종류 (2~4=지위, 5~11=소모품)");
  204. migrationBuilder.AlterColumn<int>(
  205. name: "DurationDays",
  206. table: "MemberItem",
  207. type: "int",
  208. nullable: false,
  209. defaultValue: 0,
  210. comment: "효과 지속일 (0=즉시소모)",
  211. oldClrType: typeof(int),
  212. oldType: "int",
  213. oldDefaultValue: 0,
  214. oldComment: "효과 지속일 (0=즉시소모/영구)");
  215. }
  216. }
  217. }