using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace TakeoutSaaS.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class AddProductListAndSoldoutFields : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "Kind",
                table: "products",
                type: "integer",
                nullable: false,
                defaultValue: 0,
                comment: "商品类型。");

            migrationBuilder.AddColumn<bool>(
                name: "NotifyManager",
                table: "products",
                type: "boolean",
                nullable: false,
                defaultValue: false,
                comment: "是否通知店长。");

            migrationBuilder.AddColumn<DateTime>(
                name: "RecoverAt",
                table: "products",
                type: "timestamp with time zone",
                nullable: true,
                comment: "沽清恢复时间。");

            migrationBuilder.AddColumn<int>(
                name: "RemainStock",
                table: "products",
                type: "integer",
                nullable: true,
                comment: "沽清后剩余可售。");

            migrationBuilder.AddColumn<int>(
                name: "SalesMonthly",
                table: "products",
                type: "integer",
                nullable: false,
                defaultValue: 0,
                comment: "月销量。");

            migrationBuilder.AddColumn<int>(
                name: "SoldoutMode",
                table: "products",
                type: "integer",
                nullable: true,
                comment: "沽清模式。");

            migrationBuilder.AddColumn<string>(
                name: "SoldoutReason",
                table: "products",
                type: "character varying(256)",
                maxLength: 256,
                nullable: true,
                comment: "沽清原因。");

            migrationBuilder.AddColumn<bool>(
                name: "SyncToPlatform",
                table: "products",
                type: "boolean",
                nullable: false,
                defaultValue: true,
                comment: "是否同步通知外卖平台。");

            migrationBuilder.AddColumn<string>(
                name: "TagsJson",
                table: "products",
                type: "text",
                nullable: true,
                defaultValue: "[]",
                comment: "标签 JSON（字符串数组）。");

            migrationBuilder.AddColumn<DateTime>(
                name: "TimedOnShelfAt",
                table: "products",
                type: "timestamp with time zone",
                nullable: true,
                comment: "定时上架时间。");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "Kind",
                table: "products");

            migrationBuilder.DropColumn(
                name: "NotifyManager",
                table: "products");

            migrationBuilder.DropColumn(
                name: "RecoverAt",
                table: "products");

            migrationBuilder.DropColumn(
                name: "RemainStock",
                table: "products");

            migrationBuilder.DropColumn(
                name: "SalesMonthly",
                table: "products");

            migrationBuilder.DropColumn(
                name: "SoldoutMode",
                table: "products");

            migrationBuilder.DropColumn(
                name: "SoldoutReason",
                table: "products");

            migrationBuilder.DropColumn(
                name: "SyncToPlatform",
                table: "products");

            migrationBuilder.DropColumn(
                name: "TagsJson",
                table: "products");

            migrationBuilder.DropColumn(
                name: "TimedOnShelfAt",
                table: "products");
        }
    }
}
