I ran a migration (using Fluent Migrator) and just noticed that I made a mistake on the table name on the Foreign Key.
How can I fix that? Should I run a new migration?
public class AdditionalCosts : Migration
{
public override void Up()
{
Create.Table("AdditionalCosts").WithColumn("ID").AsInt32().PrimaryKey().Identity()
.WithColumn("DocTypeID").AsInt32().NotNullable()
.WithColumn("Cost").AsInt32().NotNullable()
.WithColumn("CreatedAt").AsDateTime().Nullable().WithDefault(SystemMethods.CurrentDateTime)
.WithColumn("AddedBy").AsString().Nullable()
.WithColumn("ModifiedAt").AsDateTime().NotNullable().WithDefault(SystemMethods.CurrentDateTime)
Create.ForeignKey()
.FromTable("AdditionalCosts").ForeignColumn("DocTypeID")
.ToTable("Documents").PrimaryColumn("ID");
}
public override void Down()
{
Delete.Table("AdditionalFees");
}
}
The Foreign Key should be (different ToTable
):
Create.ForeignKey()
.FromTable("AdditionalCosts").ForeignColumn("DocTypeID")
.ToTable("DocumentTypes").PrimaryColumn("ID");