Given the following Migration:
[Migration(1)]
public class Mig001 : Migration
{
public override void Up()
{
Alter.Table("foo").AlterColumn("bar").AsInt32().Nullable();
}
public override void Down()
{
Alter.Table("foo").AlterColumn("bar").AsInt32().NotNullable();
}
}
The migrator alters a column and makes it nullable and on the rollback it does the reverse and makes it non nullable again.
Lets say data has been added to foo
since the migration; there are now rows with null in bar
column.
If it is rolled back then the operation will fail, is there any way in fluentmigrator to handle this scenario? Or what is the best practice.
bar
was a foreign key column? Can a Down method be left blank? – Gq