I am running a migration on a new Class I created that has 2 objects within it that reference different objects of the same type. Here is the class
public class AccountOpenerWorkflowStep
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public DateTime CreatedDate { get; set; }
public DateTime ModifiedDate { get; set; }
public string Controller { get; set; }
public string Action { get; set; }
public bool DefaultStep { get; set; }
[Column("TrueWorkflowStepId")]
public virtual AccountOpenerWorkflowStep TrueWorkflowStep { get; set; }
[Column("FalseWorkflowStepId")]
public virtual AccountOpenerWorkflowStep FalseWorkflowStep { get; set; }
}
So my two properties TrueWorkflowStep
and FalseWorkflowStep
will point to other objects in the same table.
The issue is when I run this migration it only creates the column FalseWorkflowStep
and not the True one.
Here is an except from the Migration
migrationBuilder.CreateTable(
name: "AccountOpenerWorkflowSteps",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
CreatedDate = table.Column<DateTime>(nullable: false),
ModifiedDate = table.Column<DateTime>(nullable: false),
Controller = table.Column<string>(nullable: true),
Action = table.Column<string>(nullable: true),
DefaultStep = table.Column<bool>(nullable: false),
FalseWorkflowStepId = table.Column<int>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AccountOpenerWorkflowSteps", x => x.Id);
table.ForeignKey(
name: "FK_AccountOpenerWorkflowSteps_AccountOpenerWorkflowSteps_False~",
column: x => x.FalseWorkflowStepId,
principalTable: "AccountOpenerWorkflowSteps",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
As you can see it is only inserting the one column of the same type.
Can anyone tell me why it does not recognize both of these columns?