20260524114747_AddProductLimitConfig.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Migrations.AppDb
  5. {
  6. /// <inheritdoc />
  7. public partial class AddProductLimitConfig : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "ProductLimitConfig",
  14. columns: table => new
  15. {
  16. ProductID = table.Column<int>(type: "int", nullable: false),
  17. UseQuantityLimit = table.Column<bool>(type: "bit", nullable: false, comment: "수량 제한 사용 여부"),
  18. MaxQuantity = table.Column<int>(type: "int", nullable: false, comment: "회원당 누적 최대 구매 수량 (0=무제한)"),
  19. UsePeriodLimit = table.Column<bool>(type: "bit", nullable: false, comment: "기간 제한 사용 여부"),
  20. PeriodType = table.Column<int>(type: "int", nullable: false, comment: "기간 유형 (0=None, 1=Day, 2=Week, 3=Month, 4=Custom)"),
  21. PeriodHours = table.Column<int>(type: "int", nullable: false, comment: "Custom 시 누적 윈도우 (시간 단위)"),
  22. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
  23. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  24. },
  25. constraints: table =>
  26. {
  27. table.PrimaryKey("PK_ProductLimitConfig", x => x.ProductID);
  28. table.ForeignKey(
  29. name: "FK_ProductLimitConfig_Product_ProductID",
  30. column: x => x.ProductID,
  31. principalTable: "Product",
  32. principalColumn: "ID",
  33. onDelete: ReferentialAction.Cascade);
  34. },
  35. comment: "상품 판매 정책 (1:1 with Product)");
  36. }
  37. /// <inheritdoc />
  38. protected override void Down(MigrationBuilder migrationBuilder)
  39. {
  40. migrationBuilder.DropTable(
  41. name: "ProductLimitConfig");
  42. }
  43. }
  44. }