72 lines
2.2 KiB
C#
72 lines
2.2 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Marco.Pms.DataAccess.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Added_BilledTo_In_Invoice_Table : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Invoices_Projects_ProjectId",
|
|
table: "Invoices");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Invoices_ProjectId",
|
|
table: "Invoices");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "BilledToId",
|
|
table: "Invoices",
|
|
type: "char(36)",
|
|
nullable: true,
|
|
collation: "ascii_general_ci");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Invoices_BilledToId",
|
|
table: "Invoices",
|
|
column: "BilledToId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Invoices_Organizations_BilledToId",
|
|
table: "Invoices",
|
|
column: "BilledToId",
|
|
principalTable: "Organizations",
|
|
principalColumn: "Id");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Invoices_Organizations_BilledToId",
|
|
table: "Invoices");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Invoices_BilledToId",
|
|
table: "Invoices");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "BilledToId",
|
|
table: "Invoices");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Invoices_ProjectId",
|
|
table: "Invoices",
|
|
column: "ProjectId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Invoices_Projects_ProjectId",
|
|
table: "Invoices",
|
|
column: "ProjectId",
|
|
principalTable: "Projects",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
}
|
|
}
|