71 lines
2.1 KiB
C#
71 lines
2.1 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace NetinaShop.Repository.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class EditDisc : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "BrandId",
|
|
schema: "public",
|
|
table: "OrderProducts",
|
|
type: "uuid",
|
|
nullable: false,
|
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "BrandId",
|
|
schema: "public",
|
|
table: "Discounts",
|
|
type: "uuid",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Discounts_BrandId",
|
|
schema: "public",
|
|
table: "Discounts",
|
|
column: "BrandId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Discounts_Brands_BrandId",
|
|
schema: "public",
|
|
table: "Discounts",
|
|
column: "BrandId",
|
|
principalSchema: "public",
|
|
principalTable: "Brands",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Discounts_Brands_BrandId",
|
|
schema: "public",
|
|
table: "Discounts");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Discounts_BrandId",
|
|
schema: "public",
|
|
table: "Discounts");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "BrandId",
|
|
schema: "public",
|
|
table: "OrderProducts");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "BrandId",
|
|
schema: "public",
|
|
table: "Discounts");
|
|
}
|
|
}
|
|
}
|