71 lines
2.3 KiB
C#
71 lines
2.3 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Marco.Pms.DataAccess.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Added_Organization_In_Employee_Table : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Organizations_Employees_CreatedById",
|
|
table: "Organizations");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Organizations_Employees_UpdatedById",
|
|
table: "Organizations");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Organizations_CreatedById",
|
|
table: "Organizations");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Organizations_UpdatedById",
|
|
table: "Organizations");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "OrganizationId",
|
|
table: "Employees",
|
|
type: "char(36)",
|
|
nullable: false,
|
|
defaultValue: new Guid("4e3a6d31-c640-40f7-8d67-6c109fcdb9ea"),
|
|
collation: "ascii_general_ci");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropColumn(
|
|
name: "OrganizationId",
|
|
table: "Employees");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Organizations_CreatedById",
|
|
table: "Organizations",
|
|
column: "CreatedById");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Organizations_UpdatedById",
|
|
table: "Organizations",
|
|
column: "UpdatedById");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Organizations_Employees_CreatedById",
|
|
table: "Organizations",
|
|
column: "CreatedById",
|
|
principalTable: "Employees",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Organizations_Employees_UpdatedById",
|
|
table: "Organizations",
|
|
column: "UpdatedById",
|
|
principalTable: "Employees",
|
|
principalColumn: "Id");
|
|
}
|
|
}
|
|
}
|