20260529074534_AddProductDiscount.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using Microsoft.EntityFrameworkCore.Migrations;
  2. #nullable disable
  3. namespace Infrastructure.Migrations.AppDb
  4. {
  5. /// <inheritdoc />
  6. public partial class AddProductDiscount : Migration
  7. {
  8. /// <inheritdoc />
  9. protected override void Up(MigrationBuilder migrationBuilder)
  10. {
  11. migrationBuilder.AddColumn<byte>(
  12. name: "DiscountType",
  13. table: "Product",
  14. type: "tinyint",
  15. nullable: false,
  16. defaultValue: (byte)0,
  17. comment: "할인 모드 (0=None, 1=Percent, 2=Amount)");
  18. migrationBuilder.AddColumn<int>(
  19. name: "DiscountValue",
  20. table: "Product",
  21. type: "int",
  22. nullable: false,
  23. defaultValue: 0,
  24. comment: "할인 값 (Percent: 0..99, Amount: 0..Price)");
  25. migrationBuilder.AlterColumn<int>(
  26. name: "Price",
  27. table: "Product",
  28. type: "int",
  29. nullable: false,
  30. comment: "정가 (P)",
  31. oldClrType: typeof(int),
  32. oldType: "int",
  33. oldComment: "판매가 (KRW)");
  34. }
  35. /// <inheritdoc />
  36. protected override void Down(MigrationBuilder migrationBuilder)
  37. {
  38. migrationBuilder.DropColumn(name: "DiscountValue", table: "Product");
  39. migrationBuilder.DropColumn(name: "DiscountType", table: "Product");
  40. migrationBuilder.AlterColumn<int>(
  41. name: "Price",
  42. table: "Product",
  43. type: "int",
  44. nullable: false,
  45. comment: "판매가 (KRW)",
  46. oldClrType: typeof(int),
  47. oldType: "int",
  48. oldComment: "정가 (P)");
  49. }
  50. }
  51. }