64 lines
2.0 KiB
C#
64 lines
2.0 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Marco.Pms.DataAccess.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Added_CreatedBy_And_CareatedAt_In_Expense : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "CreatedAt",
|
|
table: "Expenses",
|
|
type: "datetime(6)",
|
|
nullable: false,
|
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "CreatedById",
|
|
table: "Expenses",
|
|
type: "char(36)",
|
|
nullable: false,
|
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
|
collation: "ascii_general_ci");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Expenses_CreatedById",
|
|
table: "Expenses",
|
|
column: "CreatedById");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Expenses_Employees_CreatedById",
|
|
table: "Expenses",
|
|
column: "CreatedById",
|
|
principalTable: "Employees",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Expenses_Employees_CreatedById",
|
|
table: "Expenses");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Expenses_CreatedById",
|
|
table: "Expenses");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "CreatedAt",
|
|
table: "Expenses");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "CreatedById",
|
|
table: "Expenses");
|
|
}
|
|
}
|
|
}
|