Api/Netina.Repository/Migrations/20241217212716_AddSubProduc...

120 lines
3.6 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NetinaShop.Repository.Migrations
{
/// <inheritdoc />
public partial class AddSubProduct : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Discriminator",
schema: "public",
table: "Products",
type: "character varying(13)",
maxLength: 13,
nullable: false,
defaultValue: "Product");
migrationBuilder.AddColumn<int>(
name: "Diversity",
schema: "public",
table: "Products",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "DiversityDescription",
schema: "public",
table: "Products",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "DiversityValue",
schema: "public",
table: "Products",
type: "text",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsSubProduct",
schema: "public",
table: "Products",
type: "boolean",
nullable: false,
defaultValue: true);
migrationBuilder.AddColumn<Guid>(
name: "ParentId",
schema: "public",
table: "Products",
type: "uuid",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Products_ParentId",
schema: "public",
table: "Products",
column: "ParentId");
migrationBuilder.AddForeignKey(
name: "FK_Products_Products_ParentId",
schema: "public",
table: "Products",
column: "ParentId",
principalSchema: "public",
principalTable: "Products",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Products_Products_ParentId",
schema: "public",
table: "Products");
migrationBuilder.DropIndex(
name: "IX_Products_ParentId",
schema: "public",
table: "Products");
migrationBuilder.DropColumn(
name: "Discriminator",
schema: "public",
table: "Products");
migrationBuilder.DropColumn(
name: "Diversity",
schema: "public",
table: "Products");
migrationBuilder.DropColumn(
name: "DiversityDescription",
schema: "public",
table: "Products");
migrationBuilder.DropColumn(
name: "DiversityValue",
schema: "public",
table: "Products");
migrationBuilder.DropColumn(
name: "IsSubProduct",
schema: "public",
table: "Products");
migrationBuilder.DropColumn(
name: "ParentId",
schema: "public",
table: "Products");
}
}
}