76 lines
2.3 KiB
C#
76 lines
2.3 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace PostFundManagement.Infrastructure.Database.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddedActivityToIndicator : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<long>(
|
|
name: "ActivityId",
|
|
table: "Indicators",
|
|
type: "bigint",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<decimal>(
|
|
name: "ActualCost",
|
|
table: "Indicators",
|
|
type: "numeric(18,2)",
|
|
precision: 18,
|
|
scale: 2,
|
|
nullable: false,
|
|
defaultValueSql: "0");
|
|
|
|
migrationBuilder.AddColumn<decimal>(
|
|
name: "TargetCost",
|
|
table: "Indicators",
|
|
type: "numeric(18,2)",
|
|
precision: 18,
|
|
scale: 2,
|
|
nullable: false,
|
|
defaultValueSql: "0");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Indicators_ActivityId",
|
|
table: "Indicators",
|
|
column: "ActivityId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Indicators_Activities_ActivityId",
|
|
table: "Indicators",
|
|
column: "ActivityId",
|
|
principalTable: "Activities",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Indicators_Activities_ActivityId",
|
|
table: "Indicators");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Indicators_ActivityId",
|
|
table: "Indicators");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ActivityId",
|
|
table: "Indicators");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ActualCost",
|
|
table: "Indicators");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "TargetCost",
|
|
table: "Indicators");
|
|
}
|
|
}
|
|
}
|