using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations.AppDb
{
///
public partial class AddProductLimitConfig : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ProductLimitConfig",
columns: table => new
{
ProductID = table.Column(type: "int", nullable: false),
UseQuantityLimit = table.Column(type: "bit", nullable: false, comment: "수량 제한 사용 여부"),
MaxQuantity = table.Column(type: "int", nullable: false, comment: "회원당 누적 최대 구매 수량 (0=무제한)"),
UsePeriodLimit = table.Column(type: "bit", nullable: false, comment: "기간 제한 사용 여부"),
PeriodType = table.Column(type: "int", nullable: false, comment: "기간 유형 (0=None, 1=Day, 2=Week, 3=Month, 4=Custom)"),
PeriodHours = table.Column(type: "int", nullable: false, comment: "Custom 시 누적 윈도우 (시간 단위)"),
UpdatedAt = table.Column(type: "datetime2", nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductLimitConfig", x => x.ProductID);
table.ForeignKey(
name: "FK_ProductLimitConfig_Product_ProductID",
column: x => x.ProductID,
principalTable: "Product",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
},
comment: "상품 판매 정책 (1:1 with Product)");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ProductLimitConfig");
}
}
}