views:

82

answers:

1

I just began experimenting with FluentMigrator. I noticed that failed migrations are not being rolled back. Has this just not been implemented yet? This seems rather bad because it leaves the database in a broken state.

For example, the migration below will obviously fail when it tries to add Table1 for a second time (I'm just doing this to force an error). I would expect the migration to be contained in a transaction which would then be rolled back when it fails.

[Migration(1)]
public class AddTable : Migration
{
    public override void Up()
    {
        Create.Table("Table1").WithIdColumn();
        Create.Table("Table1").WithIdColumn();
    }

    public override void Down()
    {
        Delete.Table("Table1");
    }
}

However, what happens instead is that the runner throws an error (which causes the console app to crash) and the database is left with Table1 created and no row in the VersionInfo table. This seems like a bad state to leave things in.

Using latest FluentMigrator code (as of today), Visual Studio 2008 and going against SQL Server 2008 Express.

A: 

Support for transactions was added on Jan. 26.

Todd Ropog