using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace NetinaShop.Repository.Migrations
{
    /// <inheritdoc />
    public partial class EditDiscountAddCorporate : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "CorporateUserId",
                schema: "public",
                table: "Discounts",
                type: "uuid",
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "Immortal",
                schema: "public",
                table: "Discounts",
                type: "boolean",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<bool>(
                name: "IsForSaleCooperation",
                schema: "public",
                table: "Discounts",
                type: "boolean",
                nullable: false,
                defaultValue: false);

            migrationBuilder.CreateIndex(
                name: "IX_Discounts_CorporateUserId",
                schema: "public",
                table: "Discounts",
                column: "CorporateUserId");

            migrationBuilder.AddForeignKey(
                name: "FK_Discounts_Users_CorporateUserId",
                schema: "public",
                table: "Discounts",
                column: "CorporateUserId",
                principalSchema: "public",
                principalTable: "Users",
                principalColumn: "Id");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Discounts_Users_CorporateUserId",
                schema: "public",
                table: "Discounts");

            migrationBuilder.DropIndex(
                name: "IX_Discounts_CorporateUserId",
                schema: "public",
                table: "Discounts");

            migrationBuilder.DropColumn(
                name: "CorporateUserId",
                schema: "public",
                table: "Discounts");

            migrationBuilder.DropColumn(
                name: "Immortal",
                schema: "public",
                table: "Discounts");

            migrationBuilder.DropColumn(
                name: "IsForSaleCooperation",
                schema: "public",
                table: "Discounts");
        }
    }
}
