Api/Netina.Repository/Migrations/20240415212810_AddCustomerI...

73 lines
2.3 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NetinaShop.Repository.Migrations
{
/// <inheritdoc />
public partial class AddCustomerIdToPayment : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Payments_Users_UserId",
schema: "public",
table: "Payments");
migrationBuilder.RenameColumn(
name: "UserId",
schema: "public",
table: "Payments",
newName: "CustomerId");
migrationBuilder.RenameIndex(
name: "IX_Payments_UserId",
schema: "public",
table: "Payments",
newName: "IX_Payments_CustomerId");
migrationBuilder.AddForeignKey(
name: "FK_Payments_Customers_CustomerId",
schema: "public",
table: "Payments",
column: "CustomerId",
principalSchema: "public",
principalTable: "Customers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Payments_Customers_CustomerId",
schema: "public",
table: "Payments");
migrationBuilder.RenameColumn(
name: "CustomerId",
schema: "public",
table: "Payments",
newName: "UserId");
migrationBuilder.RenameIndex(
name: "IX_Payments_CustomerId",
schema: "public",
table: "Payments",
newName: "IX_Payments_UserId");
migrationBuilder.AddForeignKey(
name: "FK_Payments_Users_UserId",
schema: "public",
table: "Payments",
column: "UserId",
principalSchema: "public",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}